The empty Guid

This is a neat trick I had to google for quite some time to find.
Now I’m saving it here to never have to search for it again!

Occasionally I’ve had to create an empty Guid in T-SQL and to do so I’ve done weird things like writing a statement like this:

Copy/Paste the results into the editor and then replace every single letter with a zero.

There is, of course, an easier way to do this and it’s kinda like the Guid.Empty property you can use in C#¬†and it goes something like this:

It’s that simple.

Leave a Reply

Your email address will not be published. Required fields are marked *