共用方式為


保留關鍵字 (Transact-SQL)

適用於:sql Server Azure SQL 資料庫 Azure SQL 受控執行個體 Azure Synapse Analytics Analytics Platform System (PDW) SQL 分析端點在 Microsoft Fabric SQL 資料庫中Microsoft狀架構倉儲Microsoft網狀架構

Microsoft SQL Server 使用保留的關鍵字來定義、操作和存取資料庫。 保留關鍵字是 Transact-SQL 語言文法的一部分,SQL Server 使用這些關鍵字來剖析及理解 Transact-SQL 陳述式和批次。 雖然在語意上可以利用 SQL Server 保留關鍵字作為 Transact-SQL 指令碼中的識別碼及物件名稱,但您必須分隔這些識別碼。

下表列出 SQL Server 和 Azure Synapse Analytics 保留關鍵字。

ADD

EXTERNAL

PROCEDURE

ALL

FETCH

PUBLIC

ALTER

FILE

RAISERROR

AND

FILLFACTOR

READ

ANY

FOR

READTEXT

AS

FOREIGN

RECONFIGURE

ASC

FREETEXT

REFERENCES

AUTHORIZATION

FREETEXTTABLE

複寫

備份

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

TO

CURRENT_USER

NONCLUSTERED

頂端

CURSOR

NOT

TRAN

DATABASE

NULL

TRANSACTION

DBCC

NULLIF

TRIGGER

DEALLOCATE

OF

TRUNCATE

DECLARE

OFF

TRY_CONVERT

DEFAULT

OFFSETS

TSEQUAL

刪除

開啟

UNION

拒絕

OPEN

UNIQUE

DESC

OPENDATASOURCE

UNPIVOT

DISK

OPENQUERY

UPDATE

DISTINCT

OPENROWSET

UPDATETEXT

DISTRIBUTED

OPENXML

USE

DOUBLE

OPTION

USER

DROP

或者

VALUES

DUMP

ORDER

VARYING

ELSE

OUTER

VIEW

END

OVER

WAITFOR

ERRLVL

PERCENT

WHEN

ESCAPE

PIVOT

WHERE

EXCEPT

PLAN

WHILE

EXEC

PRECISION

WITH

執行 CREATE 陳述式之前,請先執行

PRIMARY

WITHIN GROUP

EXISTS

PRINT

WRITETEXT

EXIT

PROC

下表列出 Azure Synapse Analytics 專屬的保留關鍵字。

LABEL

另外,ISO 標準也定義了一份保留關鍵字的清單。 請避免在物件名稱和識別碼上使用 ISO 保留關鍵字。 下表所顯示的 ODBC 保留關鍵字清單與 ISO 保留關鍵字清單相同。

注意

ISO 標準保留關鍵字清單有時比 SQL Server 限制更多,有時則更少。 例如,ISO 保留關鍵字清單包含 INT。 SQL Server 並不需要將此視為保留關鍵字。

Transact-SQL 保留關鍵字可用來作為資料庫或資料庫物件 (如資料表、資料行、檢視等) 的識別碼或名稱。 請使用附加引號的識別字或分隔的識別碼。 利用保留關鍵字作為變數和預存程序參數的名稱,並不會受到限制。

ODBC 保留關鍵字

以下是 ODBC 函數呼叫所用的保留字。 這些字並不會限制最基礎的 SQL 文法;不過,為了確保與支援核心 SQL 文法的驅動程式相容,應用程式應該避免使用這些關鍵字。

這是目前的 ODBC 保留關鍵字清單。

ABSOLUTE

EXEC

OVERLAPS

動作

EXECUTE

PAD

ADA

EXISTS

PARTIAL

新增

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

收件人

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

使用者

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

SYMMETRIC

CORR

MULTISET

系統

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

TIMEZONE_MINUTE

CURRENT_PATH

TRAILING

CURRENT_ROLE

NORMALIZE

TRANSLATE_REGEX

CURRENT_SCHEMA

NUMERIC

TRANSLATION

CURRENT_TRANSFORM_GROUP_FOR_TYPE

OBJECT

TREAT

CYCLE

OCCURRENCES_REGEX

true

DATA

OLD

UESCAPE

日期

ONLY

UNDER

DAY

OPERATION

UNKNOWN

DEC

ORDINALITY

UNNEST

DECIMAL

OUT

USAGE

DEFERRABLE

OVERLAY

USING

DEFERRED

OUTPUT

DEPTH

PAD

VAR_POP

DEREF

參數

VAR_SAMP

DESCRIBE

PARAMETERS

VARCHAR

DESCRIPTOR

PARTIAL

VARIABLE

DESTROY

PARTITION

WHENEVER

DESTRUCTOR

PATH

WIDTH_BUCKET

DETERMINISTIC

POSTFIX

WITHOUT

DICTIONARY

PREFIX

WINDOW

DIAGNOSTICS

PREORDER

WITHIN

DISCONNECT

PREPARE

WORK

DOMAIN

PERCENT_RANK

WRITE

DYNAMIC

PERCENTILE_CONT

XMLAGG

EACH

PERCENTILE_DISC

XMLATTRIBUTES

ELEMENT

POSITION_REGEX

XMLBINARY

END-EXEC

PRESERVE

XMLCAST

EQUALS

PRIOR

XMLCOMMENT

EVERY

PRIVILEGES

XMLCONCAT

EXCEPTION

RANGE

XMLDOCUMENT

false

READS

XMLELEMENT

FILTER

REAL

XMLEXISTS

FIRST

RECURSIVE

XMLFOREST

FLOAT

REF

XMLITERATE

FOUND

REFERENCING

XMLNAMESPACES

FREE

REGR_AVGX

XMLPARSE

FULLTEXTTABLE

REGR_AVGY

XMLPI

FUSION

REGR_COUNT

XMLQUERY

GENERAL

REGR_INTERCEPT

XMLSERIALIZE

GET

REGR_R2

XMLTABLE

GLOBAL

REGR_SLOPE

XMLTEXT

GO

REGR_SXX

XMLVALIDATE

GROUPING

REGR_SXY

HOLD

REGR_SYY

ZONE

另請參閱

SET QUOTED_IDENTIFIER (Transact-SQL)
ALTER DATABASE 相容性層級 (Transact-SQL)