Advantage SQL Engine
Rename a data dictionary object.
sp_RenameDDObject(
ObjectName, CHARACTER,200,
NewObjectName, CHARACTER, 200,
ObjectType, INTEGER,
Options, INTEGER )
ObjectName (I) |
Name of object to rename. |
NewObjectName (I) |
New name for the object. |
ObjectType (I) |
Database object type. 1 (ADS_DD_TABLE_OBJECT) |
Options (I) |
Renaming options. Specifying 1 (ADS_KEEP_TABLE_FILE_NAME) when renaming table objects will not rename the physical table file. Specifying 0 (zero) will rename the table’s physical file. |
AE_INVALID_OBJECT_NAME |
The given new object name cannot be already in use by another dictionary object. |
AE_TABLE_NOT_EXCLUSIVE |
When renaming tables, the table must not be open by any user. |
sp_RenameDDObject can be used to rename an existing data dictionary object. Renaming tables requires that the table not be open by any user. By default, Advantage Database Server will rename the physical file to match the new table's object name. Specifying 1 (ADS_KEEP_TABLE_FILE_NAME) will cause Advantage Database Server to not rename the physical file.
If the ObjectType parameter specifies a trigger object, the ObjectName and NewObjectName parameters should be qualified with the table name the trigger belongs to followed by two colon characters ( :: ). For example, "Customers::AfterInsertTrig" would specify you want to rename the trigger called "AfterInsertTrig" that belongs to the "Customers" table.
Note Renaming a user while that user is connected is not recommended. The renamed user's permissions will not be affected in any way, but some places where the user name is logged may not reflect the user's new name.
Note Scripts, views, etc which contain references to renamed objects will not be automatically modified to reflect name changes.
EXECUTE PROCEDURE sp_RenameDDObject( 'oldtable', 'newtable', 1 /* ADS_DD_TABLE_OBJECT */, 1 /* ADS_KEEP_TABLE_FILE_NAME */ )
See Also