Unix Technical Forum

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

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 ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 03:32 AM
Mark Oueis
 
Posts: n/a
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com