How to execute sql file via command line for DB2


You can save a .sql file to your hard drive, and execute it using the DB2 command line using:

db2 -vtf C:\path\to\test.sql

-v echoes the command text back to the command line

-t sets the statement terminator to ;.

-f tells the command line to load the commands from the file.

See other command line options,