Combine stored procedure and query in T-SQL

Posted by abatishchev on Stack Overflow See other posts from Stack Overflow or by abatishchev
Published on 2010-04-01T19:38:12Z Indexed on 2010/04/01 19:43 UTC
Read the original article Hit count: 201

Filed under:
|
|
|
|

What ways are there to combine executing of a stored procedure and using it's result or parameters in a regular SQL query? Or not supported yet but planned in future versions of SQL Server. I'm afraid that I use variables when it's possible do not.

I mean next:

-- passing result of SELECT to SP
SELECT a, b FROM t
EXEC my_sp a, b

-- passing result of SP to INSERT    
INSERT INTO t
EXEC my_sp a, b

etc.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about tsql