以下是SQLSERVER 2005安裝以後內建的說明文件定義的保留字
SQL Server 2005 Compact Edition 線上叢書 |
|
|
|
保留字 (SQL Server Compact Edition) |
|
|
|
Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition) 有一些保留字,不可用於資料表和資料行的名稱。
SQL Server Compact Edition 中保留字的運作,未必與 SQL Server 2005 對應字的運作方式相同。下表列出 SQL Server Compact Edition 中的保留字。
重要事項: |
避免使用保留字做為識別碼。如果一定要使用保留字做為識別碼,就必須以雙引號分隔。 |
@@IDENTITY |
ENCRYPTION |
ORDER |
ADD |
END |
OUTER |
ALL |
ERRLVL |
OVER |
ALTER |
ESCAPE |
PERCENT |
AND |
EXCEPT |
PLAN |
ANY |
EXEC |
PRECISION |
AS |
EXECUTE |
PRIMARY |
ASC |
EXISTS |
|
AUTHORIZATION |
EXIT |
PROC |
AVG |
EXPRESSION |
PROCEDURE |
BACKUP |
FETCH |
PUBLIC |
BEGIN |
FILE |
RAISERROR |
BETWEEN |
FILLFACTOR |
READ |
BREAK |
FOR |
READTEXT |
BROWSE |
FOREIGN |
RECONFIGURE |
BULK |
FREETEXT |
REFERENCES |
BY |
FREETEXTTABLE |
REPLICATION |
CASCADE |
FROM |
RESTORE |
CASE |
FULL |
RESTRICT |
CHECK |
FUNCTION |
RETURN |
CHECKPOINT |
GOTO |
REVOKE |
CLOSE |
GRANT |
RIGHT |
CLUSTERED |
GROUP |
ROLLBACK |
COALESCE |
HAVING |
ROWCOUNT |
COLLATE |
HOLDLOCK |
ROWGUIDCOL |
COLUMN |
IDENTITY |
RULE |
COMMIT |
IDENTITY_INSERT |
SAVE |
COMPUTE |
IDENTITYCOL |
SCHEMA |
CONSTRAINT |
IF |
SELECT |
CONTAINS |
IN |
SESSION_USER |
CONTAINSTABLE |
INDEX |
SET |
CONTINUE |
INNER |
SETUSER |
CONVERT |
INSERT |
SHUTDOWN |
COUNT |
INTERSECT |
SOME |
CREATE |
INTO |
STATISTICS |
CROSS |
IS |
SUM |
CURRENT |
JOIN |
SYSTEM_USER |
CURRENT_DATE |
KEY |
TABLE |
CURRENT_TIME |
KILL |
TEXTSIZE |
CURRENT_TIMESTAMP |
LEFT |
THEN |
CURRENT_USER |
LIKE |
TO |
CURSOR |
LINENO |
TOP |
DATABASE |
LOAD |
TRAN |
DATABASEPASSWORD |
MAX |
TRANSACTION |
DATEADD |
MIN |
TRIGGER |
DATEDIFF |
NATIONAL |
TRUNCATE |
DATENAME |
NOCHECK |
TSEQUAL |
DATEPART |
NONCLUSTERED |
UNION |
DBCC |
NOT |
UNIQUE |
DEALLOCATE |
NULL |
UPDATE |
DECLARE |
NULLIF |
UPDATETEXT |
DEFAULT |
OF |
USE |
DELETE |
OFF |
USER |
DENY |
OFFSETS |
VALUES |
DESC |
ON |
VARYING |
DISK |
OPEN |
VIEW |
DISTINCT |
OPENDATASOURCE |
WAITFOR |
DISTRIBUTED |
OPENQUERY |
WHEN |
DOUBLE |
OPENROWSET |
WHERE |
DROP |
OPENXML |
WHILE |
DUMP |
OPTION |
WITH |
ELSE |
OR |
WRITETEXT |
SQL Server 2005 線上叢書 (2007 年 9 月) |
|
|
|
保留關鍵字 (Transact-SQL) |
|
更新: 2006 年 7 月 17 日
Microsoft SQL Server 2005 利用保留關鍵字來定義、操作和存取資料庫。保留的關鍵字是 SQL Server 用來剖析及瞭解 Transact-SQL 陳述式和批次之 Transact-SQL 語言文法的一部分。雖然在語意上可以利用 SQL Server 保留關鍵字作為 Transact-SQL 指令碼中的識別碼和物件名稱,但您只能利用分隔的識別碼來執行這個動作。
下表列出 SQL Server 保留關鍵字。
ADD |
EXISTS |
PRIMARY |
ALL |
EXIT |
|
ALTER |
EXTERNAL |
PROC |
AND |
FETCH |
PROCEDURE |
ANY |
FILE |
PUBLIC |
AS |
FILLFACTOR |
RAISERROR |
ASC |
FOR |
READ |
AUTHORIZATION |
FOREIGN |
READTEXT |
BACKUP |
FREETEXT |
RECONFIGURE |
BEGIN |
FREETEXTTABLE |
REFERENCES |
BETWEEN |
FROM |
REPLICATION |
BREAK |
FULL |
RESTORE |
BROWSE |
FUNCTION |
RESTRICT |
BULK |
GOTO |
RETURN |
BY |
GRANT |
REVERT |
CASCADE |
GROUP |
REVOKE |
CASE |
HAVING |
RIGHT |
CHECK |
HOLDLOCK |
ROLLBACK |
CHECKPOINT |
IDENTITY |
ROWCOUNT |
CLOSE |
IDENTITY_INSERT |
ROWGUIDCOL |
CLUSTERED |
IDENTITYCOL |
RULE |
COALESCE |
IF |
SAVE |
COLLATE |
IN |
SCHEMA |
COLUMN |
INDEX |
SECURITYAUDIT |
COMMIT |
INNER |
SELECT |
COMPUTE |
INSERT |
SESSION_USER |
CONSTRAINT |
INTERSECT |
SET |
CONTAINS |
INTO |
SETUSER |
CONTAINSTABLE |
IS |
SHUTDOWN |
CONTINUE |
JOIN |
SOME |
CONVERT |
KEY |
STATISTICS |
CREATE |
KILL |
SYSTEM_USER |
CROSS |
LEFT |
TABLE |
CURRENT |
LIKE |
TABLESAMPLE |
CURRENT_DATE |
LINENO |
TEXTSIZE |
CURRENT_TIME |
LOAD |
THEN |
CURRENT_TIMESTAMP |
NATIONAL |
TO |
CURRENT_USER |
NOCHECK |
TOP |
CURSOR |
NONCLUSTERED |
TRAN |
DATABASE |
NOT |
TRANSACTION |
DBCC |
NULL |
TRIGGER |
DEALLOCATE |
NULLIF |
TRUNCATE |
DECLARE |
OF |
TSEQUAL |
DEFAULT |
OFF |
UNION |
DELETE |
OFFSETS |
UNIQUE |
DENY |
ON |
UNPIVOT |
DESC |
OPEN |
UPDATE |
DISK |
OPENDATASOURCE |
UPDATETEXT |
DISTINCT |
OPENQUERY |
USE |
DISTRIBUTED |
OPENROWSET |
USER |
DOUBLE |
OPENXML |
VALUES |
DROP |
OPTION |
VARYING |
DUMP |
OR |
VIEW |
ELSE |
ORDER |
WAITFOR |
END |
OUTER |
WHEN |
ERRLVL |
OVER |
WHERE |
ESCAPE |
PERCENT |
WHILE |
EXCEPT |
PIVOT |
WITH |
EXEC |
PLAN |
WRITETEXT |
EXECUTE |
PRECISION |
|
另外,SQL-2003 標準也定義了一份保留關鍵字清單。請避免在物件名稱和識別碼上使用 SQL-2003 保留關鍵字。下表所顯示的 ODBC 保留關鍵字清單與 SQL-2003 保留關鍵字清單相同。
附註: |
SQL-2003 保留關鍵字清單,有時限制性大於 SQL Server,有時比較小。例如,SQL-2003 保留關鍵字清單包含 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 2005 線上叢書 (2007 年 9 月) |
|
|
|
MDX 保留字 |
|
下表包含保留以供多維度運算式 (MDX) 使用的字。您不應該在 MDX 中將這些字作為任何識別碼 (如 Cube 名稱) 或使用者自訂函數名稱的一部份使用。
ABSOLUTE |
DESC |
LEAVES |
SELF_BEFORE_AFTER |
ACTIONPARAMETERSET |
DESCENDANTS |
LEVEL |
SESSION |
ADDCALCULATEDMEMBERS |
DESCRIPTION |
LEVELS |
SET |
AFTER |
DIMENSION |
LINKMEMBER |
SETTOARRAY |
AGGREGATE |
DIMENSIONS |
LINREGINTERCEPT |
SETTOSTR |
ALL |
DISTINCT |
LINREGPOINT |
SORT |
ALLMEMBERS |
DISTINCTCOUNT |
LINREGR2 |
STDDEV |
ANCESTOR |
DRILLDOWNLEVEL |
LINREGSLOPE |
STDDEVP |
ANCESTORS |
DRILLDOWNLEVELBOTTOM |
LINREGVARIANCE |
STDEV |
AND |
DRILLDOWNLEVELTOP |
LOOKUPCUBE |
STDEVP |
AS |
DRILLDOWNMEMBER |
MAX |
STORAGE |
ASC |
DRILLDOWNMEMBERBOTTOM |
MEASURE |
STRIPCALCULATEDMEMBERS |
ASCENDANTS |
DRILLDOWNMEMBERTOP |
MEDIAN |
STRTOMEMBER |
AVERAGE |
DRILLUPLEVEL |
MEMBER |
STRTOSET |
AXIS |
DRILLUPMEMBER |
MEMBERS |
STRTOTUPLE |
BASC |
DROP |
MEMBERTOSTR |
STRTOVAL |
BDESC |
EMPTY |
MIN |
STRTOVALUE |
BEFORE |
END |
MTD |
SUBSET |
BEFORE_AND_AFTER |
ERROR |
NAME |
SUM |
BOTTOMCOUNT |
EXCEPT |
NAMETOSET |
TAIL |
BOTTOMPERCENT |
EXCLUDEEMPTY |
NEST |
THIS |
BOTTOMSUM |
EXTRACT |
NEXTMEMBER |
TOGGLEDRILLSTATE |
BY |
FALSE |
NO_ALLOCATION |
TOPCOUNT |
CACHE |
FILTER |
NO_PROPERTIES |
TOPPERCENT |
CALCULATE |
FIRSTCHILD |
NON |
TOPSUM |
CALCULATION |
FIRSTSIBLING |
NONEMPTYCROSSJOIN |
TOTALS |
CALCULATIONCURRENTPASS |
FOR |
NOT_RELATED_TO_FACTS |
TREE |
CALCULATIONPASSVALUE |
FREEZE |
NULL |
TRUE |
CALCULATIONS |
FROM |
ON |
TUPLETOSTR |
CALL |
GENERATE |
OPENINGPERIOD |
TYPE |
CELL |
GLOBAL |
OR |
UNION |
CELLFORMULASETLIST |
GROUP |
PAGES |
UNIQUE |
CHAPTERS |
GROUPING |
PARALLELPERIOD |
UNIQUENAME |
CHILDREN |
HEAD |
PARENT |
UPDATE |
CLEAR |
HIDDEN |
PASS |
USE |
CLOSINGPERIOD |
HIERARCHIZE |
PERIODSTODATE |
USE_EQUAL_ALLOCATION |
COALESCEEMPTY |
HIERARCHY |
POST |
USE_WEIGHTED_ALLOCATION |
COLUMN |
IGNORE |
PREDICT |
USE_WEIGHTED_INCREMENT |
COLUMNS |
IIF |
PREVMEMBER |
USERNAME |
CORRELATION |
INCLUDEEMPTY |
PROPERTIES |
VALIDMEASURE |
COUNT |
INDEX |
PROPERTY |
VALUE |
COUSIN |
INTERSECT |
QTD |
VAR |
COVARIANCE |
IS |
RANK |
VARIANCE |
COVARIANCEN |
ISANCESTOR |
RECURSIVE |
VARIANCEP |
CREATE |
ISEMPTY |
RELATIVE |
VARP |
CREATEPROPERTYSET |
ISGENERATION |
ROLLUPCHILDREN |
VISUAL |
CREATEVIRTUALDIMENSION |
ISLEAF |
ROOT |
VISUALTOTALS |
CROSSJOIN |
ISSIBLING |
ROWS |
WHERE |
CUBE |
ITEM |
SCOPE |
WITH |
CURRENT |
LAG |
SECTIONS |
WTD |
CURRENTCUBE |
LASTCHILD |
SELECT |
XOR |
CURRENTMEMBER |
LASTPERIODS |
SELF |
YTD |
DEFAULT_MEMBER |
LASTSIBLING |
SELF_AND_AFTER |
|
DEFAULTMEMBER |
LEAD |
SELF_AND_BEFORE |
|
留言列表