This is a discussion on Retrieving Result Set from Dynamically called Stored Procedure or function in a Function within the SQL Server forums, part of the Microsoft SQL Server category; --> Is there any way I can retrieve the result set of a Stored Procedure in a function. ALTER FUNCTION ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Is there any way I can retrieve the result set of a Stored Procedure in a function. ALTER FUNCTION dbo.fn_GroupDeviceLink ( @groupID numeric ) RETURNS @groupDeviceLink TABLE (GroupID numeric, DeviceID numeric) AS BEGIN Declare @command nvarchar(255) SELECT @command = Condition // @command is an SQL string or stored procedue name FROM DeviceGroup WHERE GroupID = @groupID INSERT @groupDeviceLink EXEC @command RETURN END Is there any way i can do anything like this. @command is a variable holding the name of a stored produre. I need to run that stored procure and return the values in such a way that they can be used in a SELECT Statement My goal is SELECT * FROM Device INNER JOIN dbo.fn_GroupDeviceLink(@groupID) ON .... this fn_GroupDeviceLink should run the proper stored procedure and return the values. What i also want to do is play with that result set of the specific stored procedure before i return it. Is this possible? If not, what is the work arround? Thanks Mark |