The data type keyword "UNIQUEIDENTIFIER" is a chore to type. I want a shorthand replacement.
At first glance, it seems that SSMS provides two; the words "GUID" and "UID" are both rendered in blue in the query editor (using the default syntax color scheme).
But they are not listed as reserved or future keywords in Microsoft Docs. I tried to use them like non-reserved data type keywords (such as "DATE" or "INT")
Declare @guid uid;
and got this error message:
Msg 2715, Level 16, State 3, Line 1 Column, parameter, or variable #1: Cannot find data type uid. Parameter or variable '@guid' has an invalid data type.
I can create a UDT for UNIQUEIDENTIFIER named "UID". The result appears to behave as a non-reserved keyword:
Create Type [uid] From uniqueidentifier null;
GO
Declare @guid uid = newid();
Print @guid;
GO
B398DA7A-0DF2-49B6-8415-82D31EAA9013
So I have two questions.
- Are the words "GUID" and "UID" actually keywords, or does SSMS color them for a different reason?
- What considerations/risks might come with using the words "GUID" or "UID" as UDT names? I'm mostly worried about future tSQL language compliance.