it contains the following:
SELECT Adress,City FROM tblUserData WHERE UserName='john'
as you can see it returns 2 columns.
I also have another SP: mysp_GetNr. This sp returns an integer.
I want to call mysp_getnr from mysp_getstuff and add the result to the 2 columns in a column named 'Number'
So the resultset from mysp_getstuff should be:
Adress, City, Number (in which the number column contains the result from mysp_GetNr)
How can I do that?
Use an OUTPUT Parameter to get the value from mysp_getnr.
Declare @.num int
EXEC mysp_getnr @.params... @.num OUTPUT
Then, in your mysp_getstuff you can either return @.num as its OUTPUT param or along with the result set.
SELECT Adress,City,Number=@.num FROM tblUserData WHERE UserName='john'.
No comments:
Post a Comment