If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > running sql files on solaris

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-20-05, 08:53
yadu yadu is offline
Registered User
 
Join Date: Oct 2005
Posts: 16
running sql files on solaris

Hi,

I want to know how to run sql files in command prompt for db2 on Solaris, something similar to @abc.sql in Oracle.

I'm new to Db2, please bear with me if this is a silly question.

Thanks
Reply With Quote
  #2 (permalink)  
Old 12-20-05, 10:12
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
db2 -tf filename.sql

Assumes that statements are separated with semicolons (";")
Reply With Quote
  #3 (permalink)  
Old 12-20-05, 10:41
Kedison Kedison is offline
Registered User
 
Join Date: Mar 2003
Location: Sacramento, California
Posts: 14
Quote:
Originally Posted by yadu
Hi,

I want to know how to run sql files in command prompt for db2 on Solaris, something similar to @abc.sql in Oracle.

I'm new to Db2, please bear with me if this is a silly question.

Thanks
Unfortunately, you can't run a script from within the db2 clp like you can in oracle (i.e @<script>). The only way to run a script is by calling the db2 clp from the OS prompt. For example, I use;

db2 -tvf <scriptname> -z <outputfile>

-t denotes the semicolon as the statement terminator (what you'll be used to in Oracle). -v is verbose, and -f is for filename. -z sends the output to a specified file (instead of "spooling" you can do this).

Kedison
Reply With Quote
  #4 (permalink)  
Old 12-20-05, 11:54
yadu yadu is offline
Registered User
 
Join Date: Oct 2005
Posts: 16
Thanks for all your replies.

It has been of much help.

I dont know why IBM Db2 information pages clearly mention about this.

Before posting, I searched for around 2 hours in all IBM information pages, but I could not get what I was looking for.

Again thanks for your replies.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On