在MSQLSMS中用蓝色和粉红色着色的单词的含义

问题描述 投票:1回答:3

Microsoft SQL Management Studio突出显示了一些用蓝色或粉红色着色的特殊单词。我想知道哪个规则决定了要使用的颜色。

例如,请考虑以下两个陈述:

SELECT * FROM myTable
UPDATE myTable SET myFlag = 'X'

SELECT * FROM myTable UPDATE myTable SET myFlag = 'X'

UPDATE是粉红色的,而SETSELECTFROM是蓝色的。

sql-server sql-server-2012 ssms syntax-highlighting
3个回答
3
投票

来自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                                    

2
投票

我想知道哪个规则决定了要使用的颜色。

这些颜色在SSMS中定义。你可以在这里看到所有颜色并改变它们:Color Coding in Query Editor

enter image description here


0
投票

这是按颜色分解的full list of reserved keywords

Reserved Keywords by Color

运营商(灰色)

所有,和,任何,之间,交叉,存在,进入,内部,是,加入,左,类似,不是,空,或,外,枢轴,右,某些,不明飞行

系统功能(品红)

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

© www.soinside.com 2019 - 2024. All rights reserved.