Using Reserved Keywords

Accessing and Changing Relational Data

Accessing and Changing Relational Data

Using Reserved Keywords

Microsoft® SQL Server™ 2000 reserves certain keywords for its exclusive use. For example, using either the Transact-SQL DUMP or BACKUP keyword in an osql or SQL Query Analyzer session tells SQL Server to make a backup copy of all or part of a database, or a backup copy of the log.

It is not legal to include the reserved keywords in a Transact-SQL statement in any location except that defined by SQL Server. No objects in the database should be given a name that matches a reserved keyword. If such a name exists, the object must always be referred to using delimited identifiers. Although this method does allow for objects whose names are reserved words, it is recommended that you do not name any database objects with a name that is the same as a reserved word.

The system and database administrators roles or the database creator is usually responsible for checking for reserved keywords in Transact-SQL code and database names.

Use a naming convention that avoids using reserved keywords. Consonants or vowels can be removed if an object name must resemble a reserved keyword. For example, a procedure named bckup that performs BACKUP statements for all user-defined databases.

See Also

Reserved Keywords

SET QUOTED_IDENTIFIER

Delimited Identifiers

CREATE TABLE

ALTER TABLE

CREATE RULE

CREATE DATABASE

ALTER DATABASE