Combination Stored Procedure

knockyo

Well-known member
Joined
Sep 20, 2006
Messages
78
Programming Experience
1-3
Combination the Stored Procedure Result (with picture)

Let's say i have 3 stored Procedure SP_A ,SP_B, SP_C

if i want combine data from SP_A with SP_B with SP_C into DataTable or DataSet, how is the code be?

Can some expert show me simple coding?

Thanks.
 
Last edited:
actually that URL and the thread is me post one, you can see that same user name. :D

----------------------

actually why i dun want to use left join and become one SP. This is because when i query by the system, it will slow down the performance.

tht's y i need separate it in different SP (stored procedure).

So any idea?
 
Combine the output, you mean?

Assuming that all stored procedures output a cursor with the same schema, just add all the sp calls to the tableadapter (read DW2 link in my sig, section multiple queries on a table adapter), ensure the ClearBeforeFill property is set to False, then call them all one after the other:

myTA.FillBySProc1(myDataTable)
myTA.FillBySProc2(myDataTable)
myTA.FillBySProc3(myDataTable)
 
this is the 1st table i generate from Stored Prod (SP_1)
com014ba.jpg


this is the 2nd table i generate from Stored Prod (SP_2)
com025nk.jpg


i want combine the table result like this with vb.net coding:
comf0kp.jpg


So, can some expert show me the simple code to do that? How to loop in the DataTable or DataSet

Thanks again.
 
yeah, that's called an SQL JOIN. Datatables dont do that - databases do that.

Why dont you post the sqls in each sproc and i'll show you how to write the join..
 
thanks cjard...

actually Im not allow to do the Joining. because it will slow down performance.

tht's y i need use 2 store prod, after that use T-SQL or VB.NET CODE to join.

did you have any idea?
 
No offence, but whomever placed that restriction on you hasnt got a clue what rdbms are all about - Microsoft/Oracle/IBM spend millions on r&d by the best minds in the industry so that their database does one thing very, very quickly -> find and join data. That's what puts the R into RDBMS :)

Youll spend more time and company money writing code to join datatables than the server would ever burn doing the joins... :)

Show me the code for sp1 and sp2..
 
Last edited:
cjard, is ok. I already get my solution. thanks

but just want to tell you about reduce performance for using JOIN table is not my idea also. I also get it from my superior only :D
 
Just out of curiosity... what was the solution?

I would have inserted the results from each query into a temp table, then joined those temp tables and returned the results.....

Sounds like your superior needs some DB training 101...

-tg
 
techgnome,

ya im using TempTable at my SP to combine those table result.

Here is my question:
using one SP JOIN all the table is that will slow down query performance? compare to the using many different kinds of SP and combine it?
 
just wait while two people at once run your sp, and the temp table gets all messed up..

why dont you just post the sqls youre using so we can actually tell you something accurate, instead of asking vague questions like "Will it slow down performance?"
 
Back
Top