Click here to Skip to main content
11,933,854 members (60,853 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked

How to get an empty GUID in SQL Server

, 19 Apr 2011 CPOL
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 6:15
memberstixoffire17-Sep-15 6:15 
GeneralNice Pin
Stark DaFixzer26-Apr-11 3:03
memberStark DaFixzer26-Apr-11 3: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.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151126.1 | Last Updated 19 Apr 2011
Article Copyright 2011 by nit_singh
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid