Created
February 19, 2015 14:33
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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