I would like to do something similar to the following code:
WITH temp as (EXEC @return_value = [Transactions].[Myproc]
@Id = 1)
SELECT * from temp
Is it possible in T-SQL?
I would like to do something similar to the following code:
WITH temp as (EXEC @return_value = [Transactions].[Myproc]
@Id = 1)
SELECT * from temp
Is it possible in T-SQL?
Here is an example Stored Procedure:
CREATE PROCEDURE [dbo].[sp_test]
AS
SELECT employee,first_name,last_name FROM employee_info
GO
And here is an example utilizing the resultset returned by the procedure:
DECLARE @EmployeeInfo as Table (
employee int,
first_name varchar(40),
last_name varchar(40)
)
INSERT INTO @EmployeeInfo
EXEC sp_test
SELECT * FROM @EmployeeInfo WHERE employee < 100 ORDER BY last_name