By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,077 Members | 1,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,077 IT Pros & Developers. It's quick & easy.

Retrieving Result Set from Dynamically called Stored Procedure or function in a Function

P: n/a
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)
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


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?


Jul 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.