June 25, 2008 at 2:25 am
I have been executing stored procs from code behind for quite some time now.
But now I want to execute a number of stored procedures using a function.
My function will take the names of the stored proc and execute them and is it possible to save the resultset as a dataset or what is recommended in this situation?
June 25, 2008 at 7:53 am
I must be missing something. SQL functions can't execute stored procedures. Are you talking about some other kind of function?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
June 25, 2008 at 8:05 am
I think OP must be talking about a function in client code.
---------------------------------------
elsasoft.org
June 25, 2008 at 8:18 am
Yes sorry if I got you confused.
I am talking about executing a batch of sp's from the code behind from a web application.
thanks.
June 25, 2008 at 10:43 am
I'm not terribly familiar with the code behind for web apps, having never written one, but I can say that two solutions come to mind from my experience:
1. I know it's possible in VBA to have one function call as many stored procs as you want. Create a connection, create a command object, run as many procs as you want from the command object.
2. You can create a "meta proc" that calls the other procs you want for one procedure call.
As far as creating a single recordset object from all of that, I'm pretty sure that can be done. I know in VBA, I could append multiple result sets into one result set. In a "meta proc", it's pretty easy to define a temp table in the meta proc, insert results from multiple sub-procs into the temp table, then return the temp table as a single result set.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply