I have a stored procedure that is returning me about 50 columns. I want to write a question, where I will be able to select a special column from the list of columns given by SP.
I tried to write tried to write exec (uspRisksEditSelect '1') from RSA_ID
but it is throwing an error to me, I think that for this we need some dynamic SQL would write. But I'm new to it.
You can not use the results of a stored proc directly - you can call it an in-store or temporary Store in the table and go from there:
DECLARE @tableVar TABLE (ID INT, name VARCHAR (50)) - Whatever your SP returns @tableVar EXEC UspRisksEditSelect '1' SELECT RSA_ID FROM @tableVar
but definitely not needed to use dynamic SQL .....
Comments
Post a Comment