return value in dynamic sql

  • Hello

    I have a dynamic script that returns a value, but i don't know how catch the return value...

     

    @sql = select var1 from table1 where sent1

    exec (@SQL)

    How I can to know the return of this query????

  • Assuming you actually need to use Dynamic sql (because you don't need to in your exemple) :

        EXEC sp_executesql @sql, N'@YourVariableHere INT OUTPUT', @YourVariableHere OUTPUT

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply