RENAME Statement
Renames databases, tables, or dictionaries. Several entities can be renamed in a single query.
Note that the RENAME
query with several entities is non-atomic operation. To swap entities names atomically, use the EXCHANGE statement.
Syntax
RENAME DATABASE
Renames databases.
Syntax
RENAME TABLE
Renames one or more tables.
Renaming tables is a light operation. If you pass a different database after TO
, the table will be moved to this database. However, the directories with databases must reside in the same file system. Otherwise, an error is returned.
If you rename multiple tables in one query, the operation is not atomic. It may be partially executed, and queries in other sessions may get Table ... does not exist ...
error.
Syntax
Example
And you can use a simpler sql:
RENAME DICTIONARY
Renames one or several dictionaries. This query can be used to move dictionaries between databases.
Syntax
See Also