Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple datasets one sql call

Status
Not open for further replies.

bassguy

Programmer
Jun 21, 2001
336
US
Hello ALL,
I am a MS SQL user but have now been tasked to connect to our AS400 for data. a few questions.

1. can I pull multiple datasets with one SQL call i.e.

commandtext=" select * from sometable ;select * from another table"

2. are there IBM equivalents of Stored procedures?

thanks in advance

Bassguy

 
To answer your questions:
If you can connect to both databases simultaneously from the same query tool, and you want the same fields from the different sets, you can use a union query to join the two together

eg
select field1, field2, field3
from table1
union
select field4, field5, field6
from table2

Regards stored procedures: I don't specifically know DB2 that well, but most client/server relational databases support stored procedures, functions and triggers and I don't think this will be very different.

John
 
I am sorry maybe I did not make it clear.

I am trying to pull 2 tables from the same db2 datadase with only one call.

bassguy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top