Monday, December 22, 2014

Run DB2 SQL Scripts on command line

Use this:


1. login as the db user - if on unix use db2profile to set environment
2.  run db2 and connect to the db2 instance
3. quit
4. run the script using
      db2 -tvf < script name>

Note: some may require special options:
db2 +c -td@ -vf <script  name>

The above means auto commit is on, use @ as the delimiter for every SQL in the script.

For more details:
db2 ? options

No comments:

Post a Comment