Previous Topic Next topic Print topic


RENAME

The RENAME statement renames an existing table.
Restriction: This topic applies to Windows environments only.

Invocation

This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared. However, if the bind option DYNAMICRULES(BIND) applies, the statement cannot be dynamically prepared.

Authorization

The privileges set defined below must include at least one of the following:

  • Ownership of the table
  • DBADM, DBCTRL, or DBMAINT authority for the database that contains the table
  • SYSADM or SYSCTRL authority

Privilege Set: If the statement is embedded in an application program, the privilege set is the privileges held by the authorization ID of the owner of the plan or package. If the statement is dynamically prepared, the privilege set is the union of the privilege sets held by each authorization ID of the process.

If the name of the existing table includes a qualifier that is different from the authorization ID of the statement, the privileges held by the authorization ID of the statement must include administrative authority.

Syntax

RENAME [TABLE] source-table-name TO target-table-name

Parameters:

source-table-name Identifies the table to be renamed.
target-table-name Is the new table name.

Description

The source table name, including the implicit or explicit qualifier, must identify a table that already exists at the current server. The name must not identify a table that has a trigger defined on it, a declared temporary table, a catalog table, an active RLST table, a view, or a synonym. The new table name must be a legal table name that does not already exist in the location. The specified source table is renamed to the new name. All privileges and indexes on the table are preserved.

Previous Topic Next topic Print topic