Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 457
User1 Avatar asked Sep 28 '22 15:09

User1


2 Answers

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.

like image 94
DavidG Avatar answered Nov 02 '22 06:11

DavidG


"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.

like image 28
JohnH Avatar answered Nov 02 '22 05:11

JohnH