Skip to content

Instantly share code, notes, and snippets.

@gonsalu
Last active October 2, 2015 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gonsalu/2299950 to your computer and use it in GitHub Desktop.
Save gonsalu/2299950 to your computer and use it in GitHub Desktop.
Using variables with sp_executesql
DECLARE @test INTEGER;
SET @test = 0;
EXEC sp_executesql N'SELECT @test_out = 1', N'@test_out INTEGER OUTPUT', @test_out=@test OUTPUT;
PRINT @test; -- prints 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment