How to create batch file to execute multiple DB2 queries

Asked By 80 points N/A Posted on -
qa-featured

I have some more questions DB2 SQL frequently.It takes a long time to run it manually. For that, I plan to create a batch file to run the DB2 SQL commands. So please let me know if it is possible to create a Windows command file to define SQL queries DB2 Run ?

SHARE
Answered By 5 points N/A #188452

How to create batch file to execute multiple DB2 queries

qa-featured

Hello,

Yes, it is possible. Consult guides for scripting in the Windows shell or consult the shell itself for more information related to organizing information and appropriate syntax. Make your file with the extension “.bat” and save it in the appropriate folder. Navigate to the folder. Use the command “db2cmd” for proper access and initiation. Then locate the script and run it. Here is a very simple sample Windows script file:

db2 -x connect to XX user XXX USING xxx
db2 -x set current sqlid=’xxx’
db2 -x set current path=zzz, current path
db2 -td@

Related Questions