I have to run some DB2 SQL queries more frequently.It is taking lot of time to do that manually. For that, I am planning to create batch file to execute those DB2 SQL commands. So,Please let me know whether it is possible to create windows batch file to run set of DB2 sql queries.
You can save a .sql
file to your hard drive, and execute it using the DB2 command line using:
db2 -vtf C:\path\to\somefile.sql
-v
echoes the command text back to the command line
-t
sets the statement terminator to ;
. If you want to use something else (creating stored procedures for example), you can use -td__
where __
represents up to two characters you can use as the terminator. Alternatively, you can use --#SET TERMINATOR __
inside your batch file
-f
tells the command line to load the commands from the file.
See other command line options here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With