Wednesday, September 25, 2013

Execute Stored Procedure in Select Statement in SQL Server

How to execute SP in Select Query:

Declare @YourTable table (Column1 int, Column2 int, Column nvarchar(100))

INSERT @YourTable
EXECUTE YourStoredProcedure @InParameter = @InParameterValue

Select * From @YourTable


Note: Columns of temporary table vairables should be same as that of the return rows of the Stored Procedure.


Happy Coding :)