Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 2 queries, one stored procedure

Author  Topic 

Astaroth
Starting Member

9 Posts

Posted - 2008-01-23 : 08:36:26
I am trying to create a stored procedure to be called from an ASP.Net page.

There are two sets of stats that I want to be able to pull off for a given ID - firstly a list of all the names given and the number of times that name has been given and secondly a list of all the reasons given and the number of times for each reason.

With the queries there is clearly different Group By required to get the necessary stats off.

I dont want to have to make two round trips to the server to get the two different results but cannot see how to otherwise to get the results out and into ASP.Net to consume?

Any ideas anyone?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-01-23 : 08:39:30
Let the SP return 2 resultsets!

And use recordset.nextrecordset method at client to get second resultset.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

sunil
Constraint Violating Yak Guru

282 Posts

Posted - 2008-01-23 : 08:40:20
Running two queries in a SP result in two resultset. You can use dataset and the two tables will table[0] and table[1]. With these two tables you can do what you want. Hope this helps.
Go to Top of Page
   

- Advertisement -