471,873 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

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)
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
0 1522

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 YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.