MicrosoftSQLServer2000保留关键字介绍
来源:网络整理 责任编辑:栏目编辑 发表时间:2013-07-01 05:11 点击:次
Microsoft SQL Server 2000 使用保留关键字定义、操作和访问数据库。保 留关键字是 SQL Server 使用的 Transact-SQL 语言语法的一部分,用于分析和理解 Transact-SQL 语句和批处理。尽管在 Transact-SQL 脚本中,使用 SQL Server 保留关键字作为标识符和对象名在语法上是可行的,但规定只能使用分隔标识符。
下表列出了 SQL Server 的保留关键字。
ADD EXCEPT PERCENT
ALL EXEC PLAN
ALTER EXECUTE PRECISION
AND EXISTS PRIMARY
ANY EXIT PRINT
AS FETCH PROC
ASC FILE PROCEDURE
AUTHORIZATION FILLFACTOR PUBLIC
BACKUP FOR RAISERROR
BEGIN FOREIGN READ
BETWEEN FREETEXT READTEXT
BREAK FREETEXTTABLE RECONFIGURE
BROWSE FROM REFERENCES
BULK FULL REPLICATION
BY FUNCTION RESTORE
CASCADE GOTO RESTRICT
CASE GRANT RETURN
CHECK GROUP REVOKE
CHECKPOINT HAVING RIGHT
CLOSE HOLDLOCK ROLLBACK
CLUSTERED IDENTITY ROWCOUNT
COALESCE IDENTITY_INSERT ROWGUIDCOL
COLLATE IDENTITYCOL RULE
COLUMN IF SAVE
COMMIT IN SCHEMA
COMPUTE INDEX SELECT
CONSTRAINT INNER SESSION_USER
CONTAINS INSERT SET
CONTAINSTABLE INTERSECT SETUSER
CONTINUE INTO SHUTDOWN
CONVERT IS SOME
CREATE JOIN STATISTICS
CROSS KEY SYSTEM_USER
CURRENT KILL TABLE
CURRENT_DATE LEFT TEXTSIZE
CURRENT_TIME LIKE THEN
CURRENT_TIMESTAMP LINENO TO
CURRENT_USER LOAD TOP
CURSOR NATIONAL TRAN
DATABASE NOCHECK TRANSACTION
DBCC NONCLUSTERED TRIGGER
DEALLOCATE NOT TRUNCATE
DECLARE NULL TSEQUAL
DEFAULT NULLIF UNION
DELETE OF UNIQUE
DENY OFF UPDATE
DESC OFFSETS UPDATETEXT
DISK ON USE
DISTINCT OPEN USER
DISTRIBUTED OPENDATASOURCE VALUES
DOUBLE OPENQUERY VARYING
DROP OPENROWSET VIEW
DUMMY OPENXML WAITFOR
DUMP OPTION WHEN
ELSE OR WHERE
END ORDER WHILE
ERRLVL OUTER WITH
ESCAPE OVER WRITETEXT
另外,SQL-92 标准还定义了保留关键字列表。不要使用 SQL-92 保留关键字作为对象名和
标识符。ODBC 保留关键字列表(如下所示)与 SQL-92 保留关键字列表相同。
说明 SQL-92 保留关键字列表有时可能比 SQL Server 限制更多,有时则限制更少。例如
,SQL-92 保留关键字列表包含 INT,而 SQL Server 不需要将其区分为保留关键字。
Transact-SQL 保留关键字可用作数据库或数据库对象(如表、列、视图等)的标识符或名
称。使用被引用的标识符或分隔标识符。对将保留关键字用作变量和存储过程参数的名称
没有限制。
ODBC 保留关键字
保留了下列关键字用于 ODBC 函数调用。这些关键字根本不约束 SQL 语法;然而,为确保
与支持核心 SQL 语法的驱动程序兼容,应用程序应避免使用这些关键字。
下面是当前的 ODBC 保留关键字列表。有关更多信息,请参见《Microsoft ODBC 3.0 程序
员参考》,第 2 卷,附录 C。
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
DA
下表列出了 SQL Server 的保留关键字。
ADD EXCEPT PERCENT
ALL EXEC PLAN
ALTER EXECUTE PRECISION
AND EXISTS PRIMARY
ANY EXIT PRINT
AS FETCH PROC
ASC FILE PROCEDURE
AUTHORIZATION FILLFACTOR PUBLIC
BACKUP FOR RAISERROR
BEGIN FOREIGN READ
BETWEEN FREETEXT READTEXT
BREAK FREETEXTTABLE RECONFIGURE
BROWSE FROM REFERENCES
BULK FULL REPLICATION
BY FUNCTION RESTORE
CASCADE GOTO RESTRICT
CASE GRANT RETURN
CHECK GROUP REVOKE
CHECKPOINT HAVING RIGHT
CLOSE HOLDLOCK ROLLBACK
CLUSTERED IDENTITY ROWCOUNT
COALESCE IDENTITY_INSERT ROWGUIDCOL
COLLATE IDENTITYCOL RULE
COLUMN IF SAVE
COMMIT IN SCHEMA
COMPUTE INDEX SELECT
CONSTRAINT INNER SESSION_USER
CONTAINS INSERT SET
CONTAINSTABLE INTERSECT SETUSER
CONTINUE INTO SHUTDOWN
CONVERT IS SOME
CREATE JOIN STATISTICS
CROSS KEY SYSTEM_USER
CURRENT KILL TABLE
CURRENT_DATE LEFT TEXTSIZE
CURRENT_TIME LIKE THEN
CURRENT_TIMESTAMP LINENO TO
CURRENT_USER LOAD TOP
CURSOR NATIONAL TRAN
DATABASE NOCHECK TRANSACTION
DBCC NONCLUSTERED TRIGGER
DEALLOCATE NOT TRUNCATE
DECLARE NULL TSEQUAL
DEFAULT NULLIF UNION
DELETE OF UNIQUE
DENY OFF UPDATE
DESC OFFSETS UPDATETEXT
DISK ON USE
DISTINCT OPEN USER
DISTRIBUTED OPENDATASOURCE VALUES
DOUBLE OPENQUERY VARYING
DROP OPENROWSET VIEW
DUMMY OPENXML WAITFOR
DUMP OPTION WHEN
ELSE OR WHERE
END ORDER WHILE
ERRLVL OUTER WITH
ESCAPE OVER WRITETEXT
另外,SQL-92 标准还定义了保留关键字列表。不要使用 SQL-92 保留关键字作为对象名和
标识符。ODBC 保留关键字列表(如下所示)与 SQL-92 保留关键字列表相同。
说明 SQL-92 保留关键字列表有时可能比 SQL Server 限制更多,有时则限制更少。例如
,SQL-92 保留关键字列表包含 INT,而 SQL Server 不需要将其区分为保留关键字。
Transact-SQL 保留关键字可用作数据库或数据库对象(如表、列、视图等)的标识符或名
称。使用被引用的标识符或分隔标识符。对将保留关键字用作变量和存储过程参数的名称
没有限制。
ODBC 保留关键字
保留了下列关键字用于 ODBC 函数调用。这些关键字根本不约束 SQL 语法;然而,为确保
与支持核心 SQL 语法的驱动程序兼容,应用程序应避免使用这些关键字。
下面是当前的 ODBC 保留关键字列表。有关更多信息,请参见《Microsoft ODBC 3.0 程序
员参考》,第 2 卷,附录 C。
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
DA
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>