[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 466
  • Last Modified:

Loading multiple tables using stored procedure

is it possible to write a stored procedure that when run in vb.net that it would fill multiple tables in the dataset?
maybe something like
select one table
.
.
.
go

select another table
.
.
.
go
0
BangorCC
Asked:
BangorCC
3 Solutions
 
Arthur_WoodCommented:
yes.  For instance, if you use a DataReader, you can then issue a NextResult method, to move to the second set of records.

AW
0
 
dfiala13Commented:
Yes.

If you use a DataAdapter's Fill method

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatacommondataadapterclassfilltopic.asp

It will automatically populate the dataset with all the returned tables defined by the multiple select statements.
0
 
dante469Commented:
Depending on the version of SQL you may not be able to put GO in your stored proc....  You do not need GO between each select :)...

The following stored proc will return multiple tables that are easily accessible from the DataAdapters.fill method...

CREATE PROCEDURE DBO.sp_EmployeeDump  AS

select * from Employee
select * from EmployeeDetail

GO
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now