Skip to content

Instantly share code, notes, and snippets.

@mvillegascuellar
Created August 7, 2018 19:40
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 mvillegascuellar/21f06c73a13f2692f004d4e779991b5b to your computer and use it in GitHub Desktop.
Save mvillegascuellar/21f06c73a13f2692f004d4e779991b5b to your computer and use it in GitHub Desktop.
DECLARE @v int = 0
SET @v = (SELECT database_id FROM sys.databases WHERE 1=2)
SELECT @v -- NULL
GO
DECLARE @v int = 0
SELECT @v = database_id FROM sys.databases WHERE 1=2
SELECT @v -- 0
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment