views:

150

answers:

1

Hi One Stored procedure returning multiple result sets and I need only the last result set, How do I achieve this without changing original procedure. am using the last reulst set in further processing in other Stored procedure.

+2  A: 

if you are "filling" a dataset in c#, very simple, just use:

datasetobj.Tables[datasetobj.Tables.Count-1].Table

to get the DataTable

if doing this within sql procedures (i.e. one procedure calling another that returns multiple), best solution would be to use output variables. concept:

procedure1 returns multiple resultsets

when calling:

declare @table1 table (), @table2 table () exec procedure1 out @table1, out @table2

AuEngineer
Sorry this is with in the other Stored Procedure
rmdussa
I can't change original Proc
rmdussa