This article was previously published under Q315689
This article has been archived. It is offered "as is" and will no longer be updated.
SQL Query Analyzer color codes words based on their category. While you can find the color code that goes with each category of words in SQL Server Books Online, it is not always easy to tell what words fit into each category. This article will help to clarify which types of words fit into each SQL Query Analyzer category for the purposes of color-coding.
To see the color code that goes with each category, see the "Color Coding in SQL Query Analyzer" topic in SQL Server Books Online.
SQL Query Analyzer has a broader definition of keywords than the SQL Server engine. The Query Analyzer list is not merely the list of words listed in SQL Server Books Online topic "Reserved Keywords." Some ODBC keywords, some future keywords, and also some other words are included in the Query Analyzer list.
The color code category "Stored Procedure" applies to any stored procedure or user-defined function that was created during the original installation of Microsoft SQL Server. Therefore, any stored procedure or function that is system-supplied is dark red.
The color code "magenta" shows up on many monitors as a "dark pink." SQL Query Analyzer color codes systems functions as "magenta." Global variables such as @@VERSION are considered by SQL Query Analyzer to be system functions.
Some words have different meanings when pre-pended with non-alphabetical characters such as the "at" signs (@@) you use with global variables or the double colons (::) you use to call functions. Currently, these types of words are only colored for one category, even though in some cases they would fit in multiple categories. Some examples are:
The @@IDENTITY global variable is color coded as a system function; however, IDENTITY, which is a keyword, is black.
The @@ROWCOUNT global variable is color coded as a system function; however, ROWCOUNT, which is a keyword, is black.
The @@TEXTSIZE global variable is color coded as a system function; however, TEXTSIZE, which is a keyword, is black.
The fn_trace_gettable system function is color coded magenta; however, the ::fn_trace_gettable system function is black.
The fn_helpcollations system function is color coded magenta; however, the ::fn_helpcollations function is black.
The version of Query Analyzer that is provided with SQL Server 2000 will color code words that were valid in Microsoft SQL Server 6.5, SQL Server 7.0, and SQL Server 2000.
The version of Query Analyzer that is provided with SQL Server 7.0 will color code words that were valid in either SQL Server 6.5 or SQL Server 7.0.
There are a handful of keywords that were valid in SQL Server 6.5 that are not valid in later releases. Therefore, some words may be color-coded; however, when you run the command against a version of SQL Server that does not support the syntax you will receive an error.
color code coding blue grey scheme colons at signs punctuation QA client tools utilities