# 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, http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.cmd.doc/doc/r0010410.html.