Description

Changes the name of an attached table.

Syntax

Rename_Table( OrigTableName, database, NewTableName, LockFlag, Status )

Parameters

The Rename_Table subroutine has the following parameters.

ParameterDescription
OrigTableNameSpecifies the name of the table to rename. To rename just the dictionary portion of a table, specify DICT.tablename. Specify DATA.tablename to rename the data portion only.

Note: If running on a network system, other users must re-attached the renamed table before they can recognize it under its new name.

Note: If you do not specify either DICT or DATA, the subroutine renames both the dictionary and the data files.

databaseSpecifies the target database for the rename process. If database is null, the table is renamed in the database where tablename exists.
NewTableNameSpecifies the new table name.
LockflagIf true (1), lock the table during the rename process.
StatusIf true (1) on return, then the table was renamed successfully. Note that while this does indicate success or failure, the Get_Status() function is the preferred method for obtaining status information.

See also

Delete_IndexGet_StatusAttach_TableAlias_TableCopy_Table

Example

/*  Renames the CUST table, in the current database, to CUST_BACKUP, locking the table during the rename process */
OldTableName = 'CUST'
NewTableName = 'CUST_BACKUP'
dbID = @DBID
LockFlag = 1
Status = ''
call Rename_Table( OldTableName, dbID, NewTableName, LockFlag, Status )
  • No labels