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?
views:
894answers:
1
+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
2009-01-09 17:35:11
you may want to specify the columns for performance purposes. Like, select column1, column2, etc...
MarlonRibunal
2009-01-12 04:37:55
I know. It was just an example.
Frans Bouma
2009-01-12 08:36:50
Make sure to add SET NOCOUNT ON or your client will see the 'x rows effected' as another resultset.
edosoft
2009-01-12 11:18:47