问题
When using Microsoft SQL Server Management Studio 14.0.17254.0 and it's query editor, I noticed that the word configuration
is always syntax highlighted as a blue keyword. Even though it doesn't appear to be in the list of Reserved Keywords. Is this a keyword in some other SQL standard or has this been a keyword before? Is there any reason this should be highlighted with the same color as SELECT
or WHERE
?
I found similar question asking about other keywords, and they all seemed to have logical reasons, but couldn't find anything for this word.
Primary reason for this question is that I want to know if using this as a column name in queries without the the brace encapsulation [configuration]
is completely safe.
回答1:
There are both Reserved Keywords, and Keywords in SQL Server. CONFIGURATION
is a keyword, but it isn't reserved. Just like int
(for the datatype int
), and other words, are a keyword , but you could still use it in a statement unquoted:
CREATE TABLE sample (int int,
date date,
char varchar(10),
last decimal(12,2),
first numeric(12,2),
system char(2));
Every single word there is a keyword of some kind (including sample
), but only CREATE
and TABLE
are reserved. char
is even a datatype and a function and isn't reserved, so you could have a nonsensical statement like CONVERT(char,CHAR(Char))
, and every reference to "char" has a different meaning.
CONFIGURATION
isn't a future keyword either, so at this time, you would seem fine to use it.
来源:https://stackoverflow.com/questions/56044348/why-does-microsoft-ssms-syntax-highlight-the-word-configuration