This article lists words and symbols that should be avoided in field, object, and variable names because they are "reserved words", words that have a specific meaning to Microsoft Access or the Microsoft Jet database engine.
For existing objects with names that contain reserved words, you can avoid errors by surrounding the object name with brackets.
-A ADD ALL (2.0, 7.0, 97) Alphanumeric ALTER AND ANY (2.0, 7.0, 97) Application AS ASC Assistant AUTOINCREMENT Avg -B BETWEEN BINARY BIT BOOLEAN BY BYTE -C CHAR, CHARACTER COLUMN CompactDatabase (2.0, 7.0, 97) CONSTRAINT Container (2.0, 7.0, 97) Count COUNTER (2.0, 7.0, 97) CREATE CreateDatabase (2.0, 7.0, 97) CreateField (2.0, 7.0, 97) CreateGroup (2.0, 7.0, 97) CreateIndex (2.0, 7.0, 97) CreateObject (2.0, 7.0, 97) CreateProperty (2.0, 7.0, 97) CreateRelation (2.0, 7.0, 97) CreateTableDef (2.0, 7.0, 97) CreateUser (2.0, 7.0, 97) CreateWorkspace (2.0, 7.0, 97) CURRENCY CurrentUser (2.0, 7.0, 97) -D DATABASE (2.0, 7.0, 97) DATE (2.0, 7.0, 97) DATETIME DELETE DESC Description DISALLOW DISTINCT DISTINCTROW Document (2.0, 7.0, 97) DOUBLE (2.0, 7.0, 97) DROP -E Echo (2.0, 7.0, 97) Else End Eqv Error EXISTS (2.0, 7.0, 97) Exit -F FALSE Field, Fields (2.0, 7.0, 97) FillCache (2.0, 7.0, 97) FLOAT, FLOAT4, FLOAT8 FOREIGN (2.0, 7.0, 97) Form, Forms FROM Full (2.0, 7.0, 97) FUNCTION -G GENERAL GetObject (2.0, 7.0, 97) GetOption (2.0, 7.0, 97) GotoPage GROUP (2.0, 7.0, 97) GROUP BY GUID (7.0, 97) -H HAVING -I Idle (2.0, 7.0, 97) IEEEDOUBLE, IEEESINGLE If IGNORE (2.0, 7.0, 97) Imp IN, In INDEX Index, Indexes (2.0, 7.0, 97) INNER INSERT InsertText (2.0, 7.0, 97) INT, INTEGER, INTEGER1, INTEGER2, INTEGER4 INTO IS, Is -J JOIN -K KEY (2.0, 7.0, 97) -L LastModified LEFT Level Like LOGICAL, LOGICAL1 LONG, LONGBINARY, LONGTEXT -M Macro Match (2.0, 7.0, 97) Max, Min, Mod MEMO Module MONEY Move (2.0, 7.0, 97) -N NAME (2.0, 7.0, 97) NewPassword (2.0, 7.0, 97) NO Not NULL NUMBER, NUMERIC -O Object (2.0, 7.0, 97) OLEOBJECT (2.0, 7.0, 97) OFF ON OpenRecordset (2.0, 7.0, 97) OPTION OR, Or ORDER Outer (2.0, 7.0, 97) OWNERACCESS -P Parameter (2.0, 7.0, 97) PARAMETERS Partial (2.0, 7.0, 97) PERCENT (2.0, 7.0, 97) PIVOT PRIMARY PROCEDURE Property (2.0, 7.0, 97) -Q Queries Query Quit (2.0, 7.0, 97) -R REAL Recalc (2.0, 7.0, 97) Recordset (2.0, 7.0, 97) REFERENCES Refresh RefreshLink (2.0, 7.0, 97) RegisterDatabase (2.0, 7.0, 97) Relation (2.0, 7.0, 97) Repaint (2.0, 7.0, 97) RepairDatabase (2.0, 7.0, 97) Report Reports Requery RIGHT -S SCREEN SECTION SELECT (2.0, 7.0, 97) SET SetFocus (2.0, 7.0, 97) SetOption (2.0, 7.0, 97) SHORT SINGLE (2.0, 7.0, 97) SMALLINT (2.0, 7.0, 97) SOME (2.0, 7.0, 97) SQL StDev, StDevP STRING Sum -T TABLE TableDef, TableDefs (2.0, 7.0, 97) TableID TEXT TIME, TIMESTAMP (2.0, 7.0, 97) TOP (2.0, 7.0, 97) TRANSFORM TRUE Type -U UNION UNIQUE UPDATE -V VALUE VALUES (2.0, 7.0, 97) Var, VarP VARBINARY, VARCHAR (2.0, 7.0, 97) -W WHERE WITH Workspace (2.0, 7.0, 97) -X Xor -Y Year YES YESNO (2.0, 7.0, 97) |
. / * : ! # & - |
Microsoft SQL Server 2000 uses reserved keywords for defining, manipulating, and accessing databases. Reserved keywords are part of the grammar of the Transact-SQL language used by SQL Server to parse and understand Transact-SQL statements and batches. Although it is syntactically possible to use SQL Server reserved keywords as identifiers and object names in Transact-SQL scripts, this can be done only using delimited identifiers.
ADD | EXCEPT | PERCENT |
ALL | EXEC | PLAN |
ALTER | EXECUTE | PRECISION |
AND | EXISTS | PRIMARY |
ANY | EXIT | |
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 |
In addition, the SQL-92 standard defines a list of reserved keywords. Avoid using SQL-92 reserved keywords for object names and identifiers. The ODBC reserved keyword list (shown below) is the same as the SQL-92 reserved keyword list.
Note: The SQL-92 reserved keywords list sometimes can be more restrictive than SQL Server and at other times less restrictive. For example, the SQL-92 reserved keywords list contains INT, which SQL Server does not need to distinguish as a reserved keyword.
Transact-SQL reserved keywords can be used as identifiers or names of databases or database objects, such as tables, columns, views, and so on. Use either quoted identifiers or delimited identifiers. The use of reserved keywords as the names of variables and stored procedure parameters is not restricted. For more information, see Using Identifiers.
The following words are reserved for use in ODBC function calls. These words do not constrain the minimum SQL grammar; however, to ensure compatibility with drivers that support the core SQL grammar, applications should avoid using these keywords.
This is the current list of ODBC reserved keywords. For more information, see Microsoft ODBC 3.0 Programmer's Reference, Volume 2, Appendix 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 |
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 |
The following keywords could be reserved in future releases of SQL Server as new features are implemented. Consider avoiding the use of these words as identifiers.
ABSOLUTE | FOUND | PRESERVE |
ACTION | FREE | PRIOR |
ADMIN | GENERAL | PRIVILEGES |
AFTER | GET | READS |
AGGREGATE | GLOBAL | REAL |
ALIAS | GO | RECURSIVE |
ALLOCATE | GROUPING | REF |
ARE | HOST | REFERENCING |
ARRAY | HOUR | RELATIVE |
ASSERTION | IGNORE | RESULT |
AT | IMMEDIATE | RETURNS |
BEFORE | INDICATOR | ROLE |
BINARY | INITIALIZE | ROLLUP |
BIT | INITIALLY | ROUTINE |
BLOB | INOUT | ROW |
BOOLEAN | INPUT | ROWS |
BOTH | INT | SAVEPOINT |
BREADTH | INTEGER | SCROLL |
CALL | INTERVAL | SCOPE |
CASCADED | ISOLATION | SEARCH |
CAST | ITERATE | SECOND |
CATALOG | LANGUAGE | SECTION |
CHAR | LARGE | SEQUENCE |
CHARACTER | LAST | SESSION |
CLASS | LATERAL | SETS |
CLOB | LEADING | SIZE |
COLLATION | LESS | SMALLINT |
COMPLETION | LEVEL | SPACE |
CONNECT | LIMIT | SPECIFIC |
CONNECTION | LOCAL | SPECIFICTYPE |
CONSTRAINTS | LOCALTIME | SQL |
CONSTRUCTOR | LOCALTIMESTAMP | SQLEXCEPTION |
CORRESPONDING | LOCATOR | SQLSTATE |
CUBE | MAP | SQLWARNING |
CURRENT_PATH | MATCH | START |
CURRENT_ROLE | MINUTE | STATE |
CYCLE | MODIFIES | STATEMENT |
DATA | MODIFY | STATIC |
DATE | MODULE | STRUCTURE |
DAY | MONTH | TEMPORARY |
DEC | NAMES | TERMINATE |
DECIMAL | NATURAL | THAN |
DEFERRABLE | NCHAR | TIME |
DEFERRED | NCLOB | TIMESTAMP |
DEPTH | NEW | TIMEZONE_HOUR |
DEREF | NEXT | TIMEZONE_MINUTE |
DESCRIBE | NO | TRAILING |
DESCRIPTOR | NONE | TRANSLATION |
DESTROY | NUMERIC | TREAT |
DESTRUCTOR | OBJECT | TRUE |
DETERMINISTIC | OLD | UNDER |
DICTIONARY | ONLY | UNKNOWN |
DIAGNOSTICS | OPERATION | UNNEST |
DISCONNECT | ORDINALITY | USAGE |
DOMAIN | OUT | USING |
DYNAMIC | OUTPUT | VALUE |
EACH | PAD | VARCHAR |
END-EXEC | PARAMETER | VARIABLE |
EQUALS | PARAMETERS | WHENEVER |
EVERY | PARTIAL | WITHOUT |
EXCEPTION | PATH | WORK |
EXTERNAL | POSTFIX | WRITE |
FALSE | PREFIX | YEAR |
FIRST | PREORDER | ZONE |
FLOAT | PREPARE |