Skip to content

Instantly share code, notes, and snippets.

@ststeiger
Created July 1, 2015 15:27
Show Gist options
  • Select an option

  • Save ststeiger/4519e5ffe282cb742252 to your computer and use it in GitHub Desktop.

Select an option

Save ststeiger/4519e5ffe282cb742252 to your computer and use it in GitHub Desktop.
Get empty GUID
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[NUID]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[NUID]
GO
CREATE FUNCTION [dbo].[NUID]()
RETURNS uniqueidentifier
AS
BEGIN
RETURN CAST('00000000-0000-0000-0000-000000000000' AS uniqueidentifier)
END
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment