Udostępnij za pośrednictwem


Transact-SQL Reserved Keywords

Microsoft SQL Server 2005 reserves certain keywords for its exclusive use. For example, using the Transact-SQL BACKUP keyword in an sqlcmd or SQL Server Code Editor 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 by using delimited identifiers. Although this method does allow for objects whose names are reserved words, we recommend 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

Concepts

Delimited Identifiers (Database Engine)

Other Resources

Reserved Keywords (Transact-SQL)
SET QUOTED_IDENTIFIER (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance