Detects and displays identifiers that are Transact-SQL reserved words. Checks server names, device names, database names, segment names, user-defined datatypes, object names, column names, user names, login names, and remote login names.
sp_checkreswords [user_name_param]
1> /* executed in the master database */ 2> sp_checkreswords
Reserved Words Used as Database Object Names for Database master Upgrade renames sysobjects.schema to sysobjects.schemacnt. Owner ------------------------------ dbo Table Reserved Word Column Names ------------------------------ ------------------------------ authorization cascade Object Type Reserved Word Object Names ------------------------------ ------------------------------ rule constraint stored procedure check user table arith_overflow user table authorization ------------------------------------------------------------- ------------------------------------------------------------- Owner ------------------------------ lemur Table Reserved Word Column Names ------------------------------ ------------------------------ key close Table Reserved Word Index Names ------------------------------ ------------------------------ key isolation Object Type Reserved Word Object Names ------------------------------ ------------------------------ default isolation rule level stored procedure mirror user table key Reserved Word Datatype Names ------------------------------ identity ------------------------------------------------------------- ------------------------------------------------------------- Database-wide Objects --------------------- Reserved Word User Names ------------------------------ at identity Reserved Word Login Names ------------------------------ at identity Reserved Word as Database Names ------------------------------ work Reserved Word as Language Names ------------------------------ national Reserved Word as Server Names ------------------------------ mirror primary Reserved Word ServerNetNames -------------------------------- mirror primary
1> /* executed in the user database, user_db */ 2> sp_checkreswords
Reserved Words Used as Database Object Names for Database user_db Upgrade renames sysobjects schema to sysobjects.schemacnt. Owner ------------------------------ tamarin Table Reserved Word Column Names ------------------------------ ------------------------------ cursor current endtran current key identity key varying schema primary schema references schema role schema some schema user schema work Table Reserved Word Index Names ------------------------------ ------------------------------ key double Object Type Reserved Word Object Names ------------------------------ ------------------------------ default escape rule fetch stored procedure foreign user table cursor user table key user table schema view endtran ------------------------------------------------------------- ------------------------------------------------------------- Database-wide Objects --------------------- Found no reserved words used as names for database-wide objects.
select * from work
work was a new reserved word in SQL Server release 10.0, part of the command commit work. Issuing the same select statement in release 10.0 or later causes a syntax error. sp_checkreswords finds identifiers that would cause these problems.
sp_checkreswords also finds reserved words, used as identifiers, that were created using the set quoted_identifier option.
Use sp_checkreswords before or immediately after upgrading to a new release of SAP ASE. For information on installing and running this procedure before performing the upgrade, see the installation documentation for your platform.
Run sp_checkreswords in the master database and in each user database. Also run it in model and sybsystemprocs, if you have added users or objects to those databases.
The return status indicates the number of items found.
If you supply a user name, sp_checkreswords checks for all of the objects that can be owned by a user tables, indexes, views, procedures, triggers, rules, defaults, and user-defined datatypes. It reports all identifiers that are reserved words.
If your current database is not the master database, and you do not provide a user name, sp_checkreswords checks for all of the objects above, with a separate section in the report for each user name. It also checks sysusers and syssegments for user names and segment names that are reserved words. You only need to check model and sybsystemprocs if you have added objects, users, or user-defined datatypes.
If your current database is master, and you do not provide a user name, sp_checkreswords performs all of the checks above and also checks sysdatabases, syslogins, syscharsets, sysservers, sysremotelogins, sysdevices, and syslanguages for reserved words used as the names of databases, local or remote logins, local and remote servers, character sets, and languages.
To change the name of a database, use sp_renamedb. The database must be in single-user mode. Drop and re-create any procedures, triggers, and views that explicitly reference the database name. For more information, see sp_renamedb.
set in Reference Manual: Commands
defncopy in the Utility Guide
Any user can execute sp_checkreswords. Permission checks do not differ based on the granular permissions settings.
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|