Skip to content

Instantly share code, notes, and snippets.

@JohnLBevan
Created February 19, 2015 14:33
Show Gist options
  • Select an option

  • Save JohnLBevan/dc4f8ecbc911e9b0ead0 to your computer and use it in GitHub Desktop.

Select an option

Save JohnLBevan/dc4f8ecbc911e9b0ead0 to your computer and use it in GitHub Desktop.
T-SQL Shorthand Empty Unique Identifier From: http://stackoverflow.com/questions/3092999/check-empty-guid-in-sql
declare @emptyGuid uniqueidentifier;
--instead of having to type:
set @emptyGuid= '{00000000-0000-0000-0000-000000000000}'
--you can do:
set @emptyGuid = cast(cast(0 as binary) as uniqueidentifier)
--or even:
set @emptyGuid = cast(0x0 as uniqueidentifier)
--REF: http://stackoverflow.com/questions/3092999/check-empty-guid-in-sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment