Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 calling stored procedure into table value function

Author  Topic 

gagani
Posting Yak Master

112 Posts

Posted - 2013-03-11 : 18:18:30
I need call the stored procedure into a table valued function
(stored procedure will return a table)

Create Function dbo.Function1() Returns @Result Table

(

Result Varchar(1000)

)

As

Begin

Insert @Result

SELECT * from 'Exec dbo.crosstab'
// HOW TO CALL THE STORED PROCEDURE RESULTS INTO THE FUNCTION
Return

end

Go

robvolk
Most Valuable Yak

15732 Posts

Posted - 2013-03-11 : 22:43:25
You can't execute procedures or dynamic SQL inside a user-defined function.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-12 : 01:20:27
you can do the inverse though...ie calling udf inside stored procedure

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -