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 > How to execute more than one sql queries from db2 prompt

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-11-10, 04:59
ronakmaini ronakmaini is offline
Registered User
 
Join Date: Feb 2010
Posts: 6
How to execute more than one sql queries from db2 prompt

Hi,

Could anyone plz tell me how to execute mutilpe SQL queries from db2 command prompt.

For example:
select count(*) from sysibm.sysdatatypes
select name from sysibm.sysdatatypes

I tried using semicolon but it failed.

Thanks,
Rons.
Reply With Quote
  #2 (permalink)  
Old 10-11-10, 05:18
nvk@vhv nvk@vhv is offline
Registered User
 
Join Date: Jan 2010
Posts: 294
Hi,

you have to put the commands in a file and execute it using
db2 -tf <File>
or
db2 -vtf <File>
Reply With Quote
  #3 (permalink)  
Old 10-11-10, 06:41
ronakmaini ronakmaini is offline
Registered User
 
Join Date: Feb 2010
Posts: 6
Thanks for the reply.

Apart from using a file, is there any other way to execute these queries from the db2 prompt itself.

Rons.
Reply With Quote
  #4 (permalink)  
Old 10-11-10, 07:15
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
db2 select * from table ; db2 select * from table
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #5 (permalink)  
Old 10-12-10, 04:31
dbBash dbBash is offline
Registered User
 
Join Date: Mar 2009
Posts: 15
Hi,

For running multiple queries from db2 prompt, you can simply run the queries without a semi colon.
eg.
select count(*) from sysibm.sysdatatypes
select name from sysibm.sysdatatypes

there is no need for a semi colon.

Regards
Tini
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