Is "Version" a Reserved word in TRANSACT-SQL? (Shows Blue but not in Reserved word list)

1.4k views Asked by At

I was writing a Stored Procedure today and Wrote the line:

SELECT pv1.Version FROM depl...

and the word Version turned blue shown below:

enter image description here

so I assumed it was a reserved word, so did some investigating here:

Reserved Keywords (TRANSACT-SQL)

But could not find the word Version in the list.

Is Version a SQL reserved word, and if not why is my word Version displaying blue? I am using SQL Management Studio 2012

4

There are 4 answers

2
DavidG On BEST ANSWER

As you rightly noted, Version is not in the official reserved word list. It's just a "feature" of SQL Server Management Studio that is showing it in blue.

There are many words like this. Here's a few more:

DESCRIPTION
SERVER
INSTEAD

There are even some words that show as pink such as LOOKUP.

0
Mureinik On

The short answer - no, it isn't. Here's an SQLFiddle that uses it as a column name in SQL-Server 2014 to prove it.

0
Peter Tirrell On

I think you can always if in doubt wrap your column name in brackets to use reserved words as column names:

select p1.[Version] from dpl...

1
JohnH On

"Version" is not a SQL Server reserved keyword.

However, it is used in a global variable used to show the OS name & version, SQL Server version, SQL Server patches and hardware attributes of the SQL Server being used.

SELECT @@VERSION

Perhaps the "Version" text turns blue in Transact-SQL because it is known to SQL Server in the context of this global variable. I'm not sure about that, this is just a theory.