katzbatz
katzbatz

Reputation: 365

Why does SSMS highlight the word UID as a keyword and what does it mean?

In SSMS, given the following statement,

enter image description here

Why is the word UID highlighted as a keyword?

Secondly, what is UID (or uid)?

Does it relate to GUIDs or User IDs or ...?

According to this answer and SQL Servers latest T-SQL reserve keyword documentation, it's not a reserved keyword. So why is it highlighted in blue?

And in case your wondering why there's no red syntax error highlighting beneath the word UID, like so:

enter image description here

... in the the first image above, it's because I'm selecting an existing column named "UID" from a table in a 3rd-party SQL Server database, whose architect(s) chose to name all tables' primary key columns "UID".

Upvotes: 4

Views: 710

Answers (2)

jw11432
jw11432

Reputation: 593

I believe it's because it's a valid SQL Server login account. Bit of info here: https://learn.microsoft.com/en-us/sql/relational-databases/native-client/applications/using-connection-string-keywords-with-sql-server-native-client?view=sql-server-ver15

I also found where this UID is a keyword (confirmed in my SSRS Tools>Options>Environment>Fonts and Colors>Display items: Keyword) referencing server user id: https://learn.microsoft.com/en-us/sql/odbc/reference/develop-app/driver-specific-connection-information?view=sql-server-ver15

Upvotes: 1

Lukasz Szozda
Lukasz Szozda

Reputation: 175596

At least for Azure Data Studio(which is a newer product than SSMS):

sql.tmLanguage.json: uid is under section "name": "keyword.other.sql"

The provided list is much broader than the one available at: Reserved Keywords (Transact-SQL) and contains values like: lineage_80_to_100, kilobytes_per_batch, ...

Upvotes: 3

Related Questions