Microsoft SQL Management Studio突出显示了一些用蓝色或粉红色着色的特殊单词。我想知道哪个规则决定了要使用的颜色。
例如,请考虑以下两个陈述:
SELECT * FROM myTable
UPDATE myTable SET myFlag = 'X'
UPDATE
是粉红色的,而SET
,SELECT
和FROM
是蓝色的。
来自SSMS > Color Coding in Query Editors
Color | Category
----------------|-------------------------------------
Red | SQL string
Dark green | Comment
Black on silver | SQLCMD command
Magenta | System function
Green | System table, view, or table-valued function.
Blue | Keyword
Teal | Line numbers or template parameter
Maroon | SQL Server stored procedure
Dark gray | Operators
这是按颜色分解的full list of reserved keywords:
运营商(灰色)
所有,和,任何,之间,交叉,存在,进入,内部,是,加入,左,类似,不是,空,或,外,枢轴,右,某些,不明飞行
系统功能(品红)
COALESCE,COLLATE,CONTAINS,CONVERT,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,NULLIF,SESSION_USER,SYSTEM_USER,TSEQUAL,UPDATE
关键词(蓝色)
ADD,ALTER,AS,ASC,AUTHORIZATION,BACKUP,BEGIN,BREAK,BROWSE,BULK,BY,CASCADE,CASE,CHECK,CHECKPOINT,CLOSE,CLUSTERED,COLUMN,COMMIT,COMPUTE,CONSTRAINT,CONTAINSTABLE,CONTINUE,CREATE,CURRENT, CURRENT_DATE,CURSOR,DATABASE,DBCC,DEALLOCATE,DECLARE,DEFAULT,DELETE,DENY,DESC,DISK,DISTINCT,DISTRIBUTED,DOUBLE,DROP,DUMP,ELSE,END,ERRLVL,ESCAPE,EXCEPT,EXEC,EXECUTE,EXIT,EXTERNAL, FETCH,FILE,FILLFACTOR,FOR,FOREIGN,FREETEXT,FREETEXTTABLE,FROM,FULL,FUNCTION,GOTO,GRANT,GROUP,HAVING,HOLDLOCK,IDENTITY,IDENTITYCOL,IDENTITY_INSERT,IF,INDEX,INSERT,INTERSECT,INTO,KEY,KILL, LINENO,LOAD,MERGE,NATIONAL,NOCHECK,NONCLUSTERED,OF,OFF,OFFSETS,ON,OPEN,OPENDATASOURCE,OPENQUERY,OPENROWSET,OPENXML,OPTION,ORDER,OVER,PERCENT,PLAN,PRECISION,PRIMARY,PRINT,PROC,PROCEDURE, PUBLIC,RAISERROR,READ,READTEXT,RECONFIGURE,REFERENCES,REPLICATION,RESTORE,RESTRICT,RETURN,REVERT,REVOKE,ROLLBACK,ROWCOUNT,ROWGUIDCOL,RULE,SAVE,SCHEMA,S ECURITYAUDIT,SELECT,SET,SETUSER,SHUTDOWN,STATISTICS,TABLE,TABLESAMPLE,TEXTSIZE,THEN,TO,TOP,TRAN,TRANSACTION,TRIGGER,TRUNCATE,UNION,UNIQUE,UPDATETEXT,USE,USER,VALUES,VARYING,VIEW,WAITFOR, WHEN,WHERE,WHILE,WITH,WRITETEXT