|
The ALTER (rename) statement allows you to change the name of indexes, user-defined functions, stored procedures, tables, triggers, or views.
ALTER object-type RENAME qualified-object-name TO new-object-name object-type ::= INDEX qualified-object-name ::= database-name.table-name.object-name database-name, table-name, object-name, new-object-name ::= user-defined name
You cannot rename the following objects if they were created with a version of Pervasive.SQL prior to Pervasive.SQL 9 SP1 (9.1):
In prior releases, the index on the name of these objects was created as not modifiable. The indexes for these objects are modifiable if the objects are created with Pervasive.SQL 9 SP1 (9.1).
You can use database-name to qualify any object-type. However, if it is used to qualify an INDEX or TRIGGER object, you must also include table-name. You can use table-name to qualify only the objects INDEX and TRIGGER.
The ALTER statement can rename an object in a database whether or not ODBC is currently connected to that database. You must use database-name to qualify object-type if the object resides in a database to which your session is not currently connected. The renamed object occurs in the same database as database-name.
If you omit database-name as a qualifier, the database to which your session is currently connected is used to identify and rename the objects.
Note that new-object-name never uses a database name as a qualifier. The context of the new name always matches the context of the original name.
Note
The database engine does not check dependencies for renamed objects. If you rename an object, ensure that all other objects with a dependency on the previous (changed from) name are revised appropriately. For example, suppose that a trigger refers a table named t1. If you rename table t1 to t5, the trigger contains invalid SQL that will not execute correctly.
The following statement alters the name of index "suplid" to "vendor_id" in the database to which your session is currently connected. The index applies to table region5.
The following statement alters the name of the user-defined function "calbrned" to "caloriesburned" in database foodforlife.
The following statement alters the name of stored procedure "checkstatus" to "eligibility" in database international.
The following statement alters the name of table "payouts" to "accts_payable" in the database to which your session is currently connected.
The following statement alters the name of trigger "testtrig3" to "new_customer" in table domestic and database electronics.
The following statement alters the name of view "suplrcds" to "vendor_codes" in the database to which your session is currently connected.
|
Chapter contents
Prev topic: ALL
|