I'm getting a uniqueidentifier
into a Stored Procedure that looks like this
00000000-0000-0000-0000-000000000000
.
This seems like a simple thing, but how can identify that this is a blank uniqueidentifier
?
If I get a value like this DDB72E0C-FC43-4C34-A924-741445153021
I want to do X
If I get a value like this 00000000-0000-0000-0000-000000000000
I do Y
Is there a more elegant way then counting up the zeros?
Thanks in advance
You can make uniqueidentifiers null.
In SQL Server, you can use the sp_special_columns system stored procedure to identify a unique identifier for the table. Specifically, it returns the optimal set of columns that uniquely identify a row in the table. It also returns columns automatically updated when any value in the row is updated by a transaction.
The globally unique identifier (GUID) data type in SQL Server is represented by the uniqueidentifier data type, which stores a 16-byte binary value. A GUID is a binary number, and its main use is as an identifier that must be unique in a network that has many computers at many sites.
compare to
cast(cast(0 as binary) as uniqueidentifier)
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With