Click here to Skip to main content
13,199,669 members (65,226 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 18 Apr 2011

How to get an empty GUID in SQL Server

, 19 Apr 2011
Rate this:
Please Sign up or sign in to vote.
A method of comparing with an empty GUID
Sometimes we need to compare a value with an empty GUID in SQL Server, and used to do something like
myValue = '00000000-0000-0000-0000-000000000000'

But instead of this, we can also do
select cast(cast(0 as binary) as uniqueidentifier)

and compare with this.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
India India
No Biography provided

You may also be interested in...


Comments and Discussions

SuggestionAlternatives Pin
stixoffire17-Sep-15 5:15
memberstixoffire17-Sep-15 5:15 
GeneralNice Pin
Stark DaFixzer26-Apr-11 2:03
memberStark DaFixzer26-Apr-11 2:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171020.1 | Last Updated 19 Apr 2011
Article Copyright 2011 by nit_singh
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid