Showing posts with label Detect empty guid. Show all posts
Showing posts with label Detect empty guid. Show all posts

Monday, May 2, 2016

Detecting an Empty Guid in Sql Server in T-Sql Syntax

Problem:

How to search for Guid.Empty in TSQL.  Thanks, Bruce!

Solution:

declare @emptyGuid uniqueidentifier      
set @emptyGuid = cast(cast(0 as binary) as uniqueidentifier)


select * from FcjcRecords
where office_id=@emptyGuid

Source:

http://www.ifinity.com.au/Blog/EntryId/81/Detecting-an-Empty-Guid-in-Sql-Server-in-T-Sql-Syntax