https://msdn.microsoft.com/zh-cn/library/ms189822(v=sql.120).aspx
Microsoft SQL Server 将保留关键字用于定义、操作和访问数据库。
保留关键字是 SQL Server 使用的 Transact-SQL 语言语法的一部分,用于分析和理解 Transact-SQL 语句和批处理。 尽管在 Transact-SQL 脚本中使用 SQL Server 保留关键字作为标识符和对象名在语法上是可行的,但规定只能使用分隔标识符。
下表列出了 SQL Server 保留关键字。
add |
EXTERNAL |
PROCEDURE |
ALL |
FETCH |
PUBLIC |
ALTER |
FILE |
RAISERROR |
And |
FILLFACTOR |
READ |
ANY |
FOR |
READTEXT |
As |
FOREIGN |
RECONFIGURE |
ASC |
FREETEXT |
REFERENCES |
AUTHORIZATION |
FREETEXTTABLE |
REPLICATION |
BACKUP |
from |
RESTORE |
BEGIN |
FULL |
RESTRICT |
BETWEEN |
FUNCTION |
RETURN |
BREAK |
GOTO |
REVERT |
BROWSE |
GRANT |
REVOKE |
BULK |
GROUP |
RIGHT |
BY |
HAVING |
ROLLBACK |
CASCADE |
HOLDLOCK |
ROWCOUNT |
Case |
IDENTITY |
ROWGUIDCOL |
CHECK |
IDENTITY_INSERT |
RULE |
CHECKPOINT |
IDENTITYCOL |
SAVE |
close |
IF |
SCHEMA |
CLUSTERED |
IN |
SECURITYAUDIT |
COALESCE |
INDEX |
SELECT |
COLLATE |
INNER |
SEMANTICKEYPHRASETABLE |
COLUMN |
INSERT |
SEMANTICSIMILARITYDETAILSTABLE |
COMMIT |
INTERSECT |
SEMANTICSIMILARITYTABLE |
COMPUTE |
INTO |
SESSION_USER |
CONSTRAINT |
is |
SET |
CONTAINS |
JOIN |
SETUSER |
CONTAINSTABLE |
KEY |
SHUTDOWN |
CONTINUE |
KILL |
SOME |
CONVERT |
LEFT |
STATISTICS |
CREATE |
LIKE |
SYSTEM_USER |
CROSS |
LINENO |
TABLE |
CURRENT |
LOAD |
TABLESAMPLE |
CURRENT_DATE |
MERGE |
TEXTSIZE |
CURRENT_TIME |
NATIONAL |
THEN |
CURRENT_TIMESTAMP |
NOCHECK |
目标 |
CURRENT_USER |
NONCLUSTERED |
TOP |
CURSOR |
NOT |
TRAN |
DATABASE |
NULL |
TRANSACTION |
DBCC |
NULLIF |
Trigger |
DEALLOCATE |
OF |
TRUNCATE |
DECLARE |
OFF |
TRY_CONVERT |
DEFAULT |
OFFSETS |
TSEQUAL |
delete |
ON |
UNION |
DENY |
OPEN |
UNIQUE |
DESC |
OPENDATASOURCE |
UNPIVOT |
DISK |
OPENQUERY |
UPDATE |
DISTINCT |
OPENROWSET |
UPDATETEXT |
DISTRIBUTED |
OPENXML |
USE |
DOUBLE |
OPTION |
USER |
DROP |
OR |
VALUES |
DUMP |
ORDER |
VARYING |
Else |
OUTER |
View |
END |
OVER |
WAITFOR |
ERRLVL |
PERCENT |
WHEN |
ESCAPE |
PIVOT |
WHERE |
EXCEPT |
PLAN |
WHILE |
EXEC |
PRECISION |
WITH |
EXECUTE |
PRIMARY |
WITHIN GROUP |
EXISTS |
|
WRITETEXT |
EXIT |
PROC |
此外,ISO 标准定义了保留关键字列表。 不要使用 ISO 保留关键字作为对象名和标识符。 ODBC 保留关键字列表(如下表所示)与 ISO 保留关键字列表相同。
注意 |
---|
ISO 标准保留关键字有时可能比 SQL Server 限制更多,有时则更少。 例如,ISO 保留关键字列表包含 INT。 SQL Server 不必将此区分为保留关键字。 |
Transact-SQL 保留关键字可用作数据库或数据库对象(如表、列、视图等)的标识符或名称。 使用带引号的标识符或分隔标识符。 不限制将保留关键字用作变量和存储过程参数的名称。
ODBC 保留关键字
保留了下列关键字以用于 ODBC 函数调用。 这些关键字根本不约束 SQL 语法;然而,为确保与支持核心 SQL 语法的驱动程序兼容,应用程序应避免使用这些关键字。
下面是当前的 ODBC 保留关键字列表。
ABSOLUTE |
EXEC |
OVERLAPS |
ACTION |
EXECUTE |
PAD |
ADA |
EXISTS |
PARTIAL |
ADD |
EXTERNAL |
PASCAL |
ALL |
EXTRACT |
POSITION |
ALLOCATE |
FALSE |
PRECISION |
ALTER |
FETCH |
PREPARE |
AND |
FIRST |
PRESERVE |
ANY |
FLOAT |
PRIMARY |
ARE |
FOR |
PRIOR |
AS |
FOREIGN |
PRIVILEGES |
ASC |
FORTRAN |
PROCEDURE |
ASSERTION |
FOUND |
PUBLIC |
AT |
FROM |
READ |
AUTHORIZATION |
FULL |
REAL |
AVG |
GET |
REFERENCES |
BEGIN |
GLOBAL |
RELATIVE |
BETWEEN |
GO |
RESTRICT |
BIT |
GOTO |
REVOKE |
BIT_LENGTH |
GRANT |
RIGHT |
BOTH |
GROUP |
ROLLBACK |
BY |
HAVING |
ROWS |
CASCADE |
HOUR |
SCHEMA |
CASCADED |
IDENTITY |
SCROLL |
CASE |
IMMEDIATE |
SECOND |
CAST |
IN |
SECTION |
CATALOG |
INCLUDE |
SELECT |
CHAR |
INDEX |
SESSION |
CHAR_LENGTH |
INDICATOR |
SESSION_USER |
CHARACTER |
INITIALLY |
SET |
CHARACTER_LENGTH |
INNER |
SIZE |
CHECK |
INPUT |
SMALLINT |
CLOSE |
INSENSITIVE |
SOME |
COALESCE |
INSERT |
SPACE |
COLLATE |
INT |
SQL |
COLLATION |
INTEGER |
SQLCA |
COLUMN |
INTERSECT |
SQLCODE |
COMMIT |
INTERVAL |
SQLERROR |
CONNECT |
INTO |
SQLSTATE |
CONNECTION |
IS |
SQLWARNING |
CONSTRAINT |
ISOLATION |
SUBSTRING |
CONSTRAINTS |
JOIN |
SUM |
CONTINUE |
KEY |
SYSTEM_USER |
CONVERT |
LANGUAGE |
TABLE |
CORRESPONDING |
LAST |
TEMPORARY |
COUNT |
LEADING |
THEN |
CREATE |
LEFT |
TIME |
CROSS |
LEVEL |
TIMESTAMP |
CURRENT |
LIKE |
TIMEZONE_HOUR |
CURRENT_DATE |
LOCAL |
TIMEZONE_MINUTE |
CURRENT_TIME |
LOWER |
TO |
CURRENT_TIMESTAMP |
MATCH |
TRAILING |
CURRENT_USER |
MAX |
TRANSACTION |
CURSOR |
MIN |
TRANSLATE |
DATE |
MINUTE |
TRANSLATION |
DAY |
MODULE |
TRIM |
DEALLOCATE |
MONTH |
TRUE |
DEC |
NAMES |
UNION |
DECIMAL |
NATIONAL |
UNIQUE |
DECLARE |
NATURAL |
UNKNOWN |
DEFAULT |
NCHAR |
UPDATE |
DEFERRABLE |
NEXT |
UPPER |
DEFERRED |
NO |
USAGE |
DELETE |
NONE |
USER |
DESC |
NOT |
USING |
DESCRIBE |
NULL |
VALUE |
DESCRIPTOR |
NULLIF |
VALUES |
DIAGNOSTICS |
NUMERIC |
VARCHAR |
DISCONNECT |
OCTET_LENGTH |
VARYING |
DISTINCT |
OF |
VIEW |
DOMAIN |
ON |
WHEN |
DOUBLE |
ONLY |
WHENEVER |
DROP |
OPEN |
WHERE |
ELSE |
OPTION |
WITH |
END |
OR |
WORK |
END-EXEC |
ORDER |
WRITE |
ESCAPE |
OUTER |
YEAR |
EXCEPT |
OUTPUT |
ZONE |
EXCEPTION |
|
|
将来的关键字
下列关键字可能会在将来的 SQL Server 版本中保留使用,作为将来要实现的新功能。 注意,不要使用这些关键字作为标识符。
ABSOLUTE |
HOST |
RELATIVE |
|||
ACTION |
HOUR |
RELEASE |
|||
ADMIN |
IGNORE |
RESULT |
|||
AFTER |
IMMEDIATE |
RETURNS |
|||
AGGREGATE |
INDICATOR |
ROLE |
|||
Alias |
INITIALIZE |
ROLLUP |
|||
ALLOCATE |
INITIALLY |
ROUTINE |
|||
ARE |
INOUT |
ROW |
|||
ARRAY |
INPUT |
ROWS |
|||
ASENSITIVE |
INT |
SAVEPOINT |
|||
ASSERTION |
INTEGER |
SCROLL |
|||
ASYMMETRIC |
INTERSECTION |
SCOPE |
|||
AT |
INTERVAL |
SEARCH |
|||
ATOMIC |
ISOLATION |
SECOND |
|||
BEFORE |
ITERATE |
SECTION |
|||
BINARY |
LANGUAGE |
SENSITIVE |
|||
BIT |
LARGE |
SEQUENCE |
|||
BLOB |
LAST |
SESSION |
|||
BOOLEAN |
LATERAL |
SETS |
|||
BOTH |
LEADING |
SIMILAR |
|||
BREADTH |
LESS |
SIZE |
|||
CALL |
LEVEL |
SMALLINT |
|||
CALLED |
LIKE_REGEX |
SPACE |
|||
CARDINALITY |
LIMIT |
SPECIFIC |
|||
CASCADED |
LN |
SPECIFICTYPE |
|||
CAST |
LOCAL |
SQL |
|||
CATALOG |
LOCALTIME |
SQLEXCEPTION |
|||
CHAR |
LOCALTIMESTAMP |
SQLSTATE |
|||
CHARACTER |
LOCATOR |
SQLWARNING |
|||
CLASS |
MAP |
START |
|||
CLOB |
MATCH |
状态 |
|||
COLLATION |
MEMBER |
STATEMENT |
|||
COLLECT |
METHOD |
STATIC |
|||
COMPLETION |
MINUTE |
STDDEV_POP |
|||
CONDITION |
MOD |
STDDEV_SAMP |
|||
CONNECT |
MODIFIES |
STRUCTURE |
|||
CONNECTION |
MODIFY |
SUBMULTISET |
|||
CONSTRAINTS |
MODULE |
SUBSTRING_REGEX |
|||
CONSTRUCTOR |
MONTH |
SYMMETRIC |
|||
CORR |
MULTISET |
SYSTEM |
|||
CORRESPONDING |
NAMES |
TEMPORARY |
|||
COVAR_POP |
NATURAL |
TERMINATE |
|||
COVAR_SAMP |
NCHAR |
THAN |
|||
CUBE |
NCLOB |
TIME |
|||
CUME_DIST |
NEW |
TIMESTAMP |
|||
CURRENT_CATALOG |
NEXT |
TIMEZONE_HOUR |
|||
CURRENT_DEFAULT_TRANSFORM_GROUP |
NO |
TIMEZONE_MINUTE |
|||
CURRENT_PATH |
NONE |
TRAILING |
|||
CURRENT_ROLE |
NORMALIZE |
TRANSLATE_REGEX |
|||
CURRENT_SCHEMA |
赞 (0) 打赏 微信扫一扫 相关文章:
版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。 发表评论
推荐阅读
www.887551.com 保留所有权利. 粤ICP备17035492号-1 站长QQ:2386932994 | 联系邮箱:2386932994@qq.com |