February 7, 2006 at 1:41 pm
I want to call a SP and set the result to a varible within a main SP. Then I want to use the Varible in the WHERE Condition in the main SP:
Create Procedure dbo.GetX AS
--*** Call SP and set result to X
DECLARE @X Smallint
Execute @X = dbo.SP
--*** Select Records from table based on X value
SELECT * FROM table WHERE X = @X
RETURN
The problem is that I only want to return the data from the SELECT Statement, but I get two data sets. X is returned first, then the SELECT Statement. Is there some way to Stop X from returning???
Thanks
fryere
February 7, 2006 at 1:48 pm
1st dataset must come from dbo.SP.
Eliminate SELECT statement from that SP.
RETURN @Value is only thing you need.
_____________
Code for TallyGenerator
February 7, 2006 at 1:59 pm
How will I assign a Value to @X without a select statement in the remote SP??
fryere
February 7, 2006 at 2:06 pm
Sorry, I updated my post too late.
Execute @X = dbo.SP assigns to @X RETURN_VALUE, not anything from returning recordset.
By default RETURN_VALUE = Error code but you cann assign any value by statement RETURN @Value
_____________
Code for TallyGenerator
February 8, 2006 at 6:03 am
Got it.... Thanks.
fryere
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply