Wednesday, March 7, 2012

How to Call a sproc from within a UDF that returns a table?

Hi. This is a SQL question.

I am trying to wrap a stored procedure with a UDF so I can do selects against the result. The following doesn't work, but is it possible to do something like:

Create Function test()
returns @.tmptable ( myfieldint)
as
begin
insert into @.tmp (field1)
Exec dbo.MySprocWhichRequires3ParmsAndReturnsATable 5, 6, 10 output
return
end

Thanks

There's a chance something similar to this could work

http://blogs.claritycon.com/blogs/curtis_swartzentruber/archive/2006/04/12/384.aspx

No comments:

Post a Comment