Executing a SQL file in DB2 database

August 4, 2012 in Database

You can execute a SQL file in a DB2 database simply using the following command in the DB2 CLP (Command Line Processor), Let’s assume that the file name you want to run is "myfile.sql":

db2 -tvf myfile.sql

Before you execute this command, you need to connect to the database which you will apply the script to using:

db2 connect to yourDatabase

Comments are closed.

Skip to toolbar