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?