RENAME TABLE

From Lianjapedia
Jump to: navigation, search

Purpose

Change the name of a table

Syntax

RENAME TABLE [<database>!]<sourcetablename> | (<expC>) [TO] [<database>!]<targettablename> | (<expC>)

See Also

ADATABASES(), ADD TABLE, ALTER TABLE, ALTER INDEX, CLOSE DATABASES, CLOSE TABLES, COMPARE DATABASE, COMPILE DATABASE, COPY Commands, COPY DATABASE, COPY FILE, COPY TABLE, CREATE DATABASE, CREATE INDEX, CREATE TABLE, CREATE VIEW, DBUSED(), DISPLAY DATABASE, DISPLAY INDEXES, DISPLAY SCHEMAS, DISPLAY TABLES, DROP DATABASE, DROP INDEX, DROP TABLE, GETENV(), LIST DATABASE, LIST INDEXES, LIST SCHEMAS, LIST TABLES, OPEN DATABASE, REMOVE TABLE, RENAME, RENAME Commands, SET AUTOCATALOG, SET DATADIR, SET EXCLUSIVE, SET SQL, USE

Description

The RENAME TABLE command renames <sourcetablename> to <targettablename>. Either filename can be substituted with an <expC>, enclosed in round brackets, which returns a valid filename. If <targettablename> already exists, the original file is overwritten. The <sourcetablename> and <targettablename> must not be open.

The <tablename1> associated files: memo (.dbt), index (.dbx) and rules (.dbd) are also renamed.

The <database>! prefix can optionally be specified for the source and target tablenames. If the source and target databases are different, the databases must not be open.

From v9.4.8.

Example

open database southwind
rename table employees to staff
close data
 
rename table southwind!staff sw!staff
rename table sw!staff southwind!employees