为什么 Microsoft SSMS 语法突出显示“配置"一词? [英] Why does Microsoft SSMS syntax highlight the word "configuration"?
问题描述
在使用 Microsoft SQL Server Management Studio 14.0.17254.0 及其查询编辑器时,我注意到 configuration
一词始终在语法上突出显示为蓝色关键字.即使它似乎不在
我在询问其他关键字时发现了类似的问题,它们似乎都有逻辑上的原因,但找不到与此词相关的任何内容.
这个问题的主要原因是我想知道在没有大括号封装[configuration]
的查询中使用它作为列名是否是完全安全的.
SQL Server 中既有保留关键字,也有关键字.CONFIGURATION
是一个关键字,但不是保留的.就像 int
(对于数据类型 int
)一样,是一个关键字,但您仍然可以在不加引号的语句中使用它:
CREATE TABLE 示例 (int int,日期日期,字符 varchar(10),最后一位小数(12,2),第一个数字(12,2),系统字符(2));
每个单词都有某种关键字(包括sample
),但只有CREATE
和TABLE
被保留.char
甚至是一个数据类型和一个函数,并且不是保留的,所以你可以有一个像 CONVERT(char,CHAR(Char)) 这样无意义的语句code>,并且每次提到char"都有不同的含义.
CONFIGURATION
不是 future 关键字,所以这个时候,你似乎可以使用它.
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.
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.
这篇关于为什么 Microsoft SSMS 语法突出显示“配置"一词?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!