Steve Crane
Steve Crane

Reputation: 4440

What does green highlighted SQL table name indicate?

In Transact-SQL code in Visual Studio and SQL Management Studio, some but not all table names are highlighted in green.

For example, in the following code

INSERT INTO library.Parameters (...
INSERT INTO library.Events (...
INSERT INTO library.EventConditions (...
INSERT INTO library.Devices (...

the Parameters and Events table names are shown in green but the EventConditions and Devices table names are not shown in green.

Upvotes: 2

Views: 2572

Answers (2)

MusicLovingIndianGirl
MusicLovingIndianGirl

Reputation: 5947

Parameters and events turn to green because it is the name of a catalog view - Explanation of Catalog Views

Check this.

Specifically sys.events and sys.parameters are Object Catalog Views, which would explain the highlighting of the table names mentioned in the question.

Upvotes: 1

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239646

The syntax highlighter for SQL is quite simplistic and is unable to take context into account - any symbol that has a special meaning in any context will receive colouring based on that meaning.

Parameters and Events are two such symbols, so they're not marked in the same way that other table names are (which use symbols with no special meaning)

In the same way, for example, in this CREATE TABLE:

create table T (
    date int,
    ID int
)

date and ID will receive different highlighting because date is also the name of a data type:

enter image description here

Upvotes: 1

Related Questions