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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Combining stored procedure results

Author  Topic 

Shaft
Starting Member

5 Posts

Posted - 2006-12-12 : 10:24:36
Hi All,

I've created 4 stored procedures that all have employeeID in common and I want to combine the results, using one stored procedure so that I can display the results in a vb.net datagrid. I've tried combining the results in a dataset in .net but have failed to get them to display alltogether in a datgrid, I can only get individual stored procedures results to show.

Thank u in advance

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-12-12 : 10:37:55
either put your 4 result sets into one resultset in the stored procedure with putting the results into a pre-created
temp table with
insert into #temp1
exec sproc1
and then "union all"-ing all of the temp tables

or

use
DataTable.ImportRow
method to import rows into the resultset you want on the client.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-12 : 11:17:12
or

Have other procedure where you copy the result to temp table

insert into #temp1
exec sproc1
insert into #temp1
exec sproc2
etc


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Shaft
Starting Member

5 Posts

Posted - 2006-12-12 : 11:39:05
Thanks for the reply but I don't think I've explained myself very well the information from each table is different but relates by employeeID eg (SPROC 1:EmployeeID, FirstName, Surname SPROC 2:EmployeeID, AuditScore) and I want to combine them into (SPROC:EmployeeID, FirstName, Surname, AuditScore)so I don't think your method will work but I'm new to stored procedures so not sure.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-12 : 11:49:32
I think you need to use Join
or post some sample data with expected result

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -