469,088 Members | 1,268 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,088 developers. It's quick & easy.

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

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
Jul 20 '05 #1
0 1454

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Wojciech Wendrychowicz | last post: by
37 posts views Thread by sam44 | last post: by
11 posts views Thread by Nemisis | last post: by
reply views Thread by kglaser89 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.