views:

894

answers:

1

I need to make two queries on two different tables and the data isn't really related. So when I call the stored proc through my code, I should be getting a DataSet with two DataTables, one DataTable for each query. How is that done in SQL Server stored procs?

+7  A: 

Simply execute two SELECT statements in the proc:

SELECT * FROM Foo
SELECT * FROM Bla

when you then Fill() a dataset, you'll get two datatables, one with the first resultset, the other with the second.

Frans Bouma
you may want to specify the columns for performance purposes. Like, select column1, column2, etc...
MarlonRibunal
I know. It was just an example.
Frans Bouma
Make sure to add SET NOCOUNT ON or your client will see the 'x rows effected' as another resultset.
edosoft