Tuesday, March 3, 2020

Check for empty GUID in SQL

select cast(cast(0 as binary) as uniqueidentifier)

Declare @GuidParam uniqueidentifier

 SET  @GuidParam ='00000000-0000-0000-0000-000000000000'


IF @GuidParam = CAST(CAST(0 AS BINARY) AS UNIQUEIDENTIFIER)
BEGIN
   --Guid is empty
END

No comments:

Post a Comment

Mixed Content: The page at xxx was loaded over HTTPS, but requested an insecure

 Mixed Content: The page at ' https ://www.test.com/signup.aspx' was loaded over HTTPS, but requested an insecure script ' http ...