IBM Books

SQL Reference

RENAME TABLE

The RENAME TABLE statement renames an existing table.

Invocation

This statement can be embedded in an application program or issued through the use of dynamic SQL statements. It is an executable statement that can be dynamically prepared.

Authorization

The privileges held by the authorization ID of the statement must include either SYSADM or DBADM authority or CONTROL privilege.

Syntax

           .-TABLE-.
>>-RENAME--+-------+--source-table-name--TO--target-identifier--><
 

Description

source-table-name
Names the existing table that is to be renamed. The name, including the schema name, must identify a table that already exists in the database (SQLSTATE 42704). It can be an alias identifying the table. It must not be the name of a catalog table (SQLSTATE 42832), a summary table, a typed table (SQLSTATE 42997) or an object of other than table or alias (SQLSTATE 42809).

target-identifier
Specifies the new name for the table without a schema name. The schema name of the source-table-name is used to qualify the new name for the table. The qualified name must not identify a table, view, or alias that already exists in the database (SQLSTATE 42710).

Rules

The source table must not:

An error (SQLSTATE 42986) is returned if the source table violates one or more of these conditions.

Notes

Example

Change the name of the EMP table to EMPLOYEE.

  RENAME TABLE EMP TO EMPLOYEE


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]