Forum Moderators: open
I'm using SQL Server 2000. I've got 2 stored procedures. Let's call them SP1 and SP2. SP1 is the control procedure, that has no parameters, it is just called. SP2 is the worker procedure, that accepts a parameter and returns a result. The idea is that SP1 looks up data from the database, and performs SP2 on each row found. SP1 then returns all this data.
Does that make any kind of sense?
Basically, I've got it working, but with a cursor. I create a local temporary table, and on each iteration of the cursor, the second stored procedure is called, and the result added to the temporary table.
While this works, I now need to extend it. This would result in a nested cursor, which I kinda want to avoid. Is there any way that I can do what I explained above, but without a cursor? Is there any way I can create an INSERT statement that calls another stored procedure as one of it's parameters...for example...
INSERT INTO table1 (result) VALUES (exec SP2 param1, param2)
...or something like that?
I'm really sorry if this makes no sense...I'm pretty rusty on the old SQL!
Cheers - any help or advice will be greatly appreciated!
B