How do I get an stored procedure output into a variable inside a function in T-SQL?

Posted by Ivan on Stack Overflow See other posts from Stack Overflow or by Ivan
Published on 2010-05-10T10:00:14Z Indexed on 2010/05/10 10:04 UTC
Read the original article Hit count: 359

I've got a task which can be only accomplished by construction a QUERY at runtime and executing it with sp_executesql. The result has to be a boolean (0/1 integer) value which I need to return as a result of the function.

The only way I found to capture an SP's output is "INSERT INTO [table] EXECUTE [sp]" query, but functions forbid this.

Any ideas how to overcome this?

© Stack Overflow or respective owner

Related posts about tsql

Related posts about sql-server