Hi all,
I'm wondering if it's possible (and how one would go about it) to return a SELECT statement's rowset from a stored procedure to another sp, without a table-value parameter or anything like that.
For example, say I have a simple proc "Proc1":
Select 'x' as x, 'y' as y
...and say I want to use that resultset in "proc2"...say in a cursor (please don't pontificate about the evils of cursors, this is more of an academic question):
So what i'm looking for "Proc2" to look something like this:
Declare cTest cursor for exec Proc1
********* or *********
Declare cTest cursor for Select * FROM exec Proc1
I'm looking for some general guidance here on how this might be accomplished, if it indeed can be accomlished.
I've tried the above cursor statement and it doesn't work, so I'm wondering if it's just a case where it can't be done or if i'm just doing it wrong.
Thanks,
--Jim
I'm wondering if it's possible (and how one would go about it) to return a SELECT statement's rowset from a stored procedure to another sp, without a table-value parameter or anything like that.
For example, say I have a simple proc "Proc1":
Select 'x' as x, 'y' as y
...and say I want to use that resultset in "proc2"...say in a cursor (please don't pontificate about the evils of cursors, this is more of an academic question):
So what i'm looking for "Proc2" to look something like this:
Declare cTest cursor for exec Proc1
********* or *********
Declare cTest cursor for Select * FROM exec Proc1
I'm looking for some general guidance here on how this might be accomplished, if it indeed can be accomlished.
I've tried the above cursor statement and it doesn't work, so I'm wondering if it's just a case where it can't be done or if i'm just doing it wrong.
Thanks,
--Jim