Removing (Dropping) a Table - Firebird

DROP TABLE

Use DROP TABLE to remove an entire table permanently from the database. This is permanent and, once committed, cannot be undone.

DROP TABLE name;

The following statement drops the table PERSONNEL:

DROP TABLE PERSONNEL;

RECREATE TABLE

Sometimes, you may want to drop a table and create it again “from scratch.” For these occasions, Firebird has RECREATE TABLE, which does the following:

  • Drops the existing table and all of the objects belonging to it
  • Commits the change
  • Creates the new table as specified in the clauses and sub-clauses

Syntax

The syntax is identical to that of CREATE TABLE. Simply substitute the CREATE keyword with RECREATE and proceed.

Restrictions and Recommendations

If the table is in use when you submit the DROP or RECREATE statement, the request will be denied, with an “Object xxxxx is in use” message.

Always take a backup before any activity that changes metadata.

Although it is possible to make metadata changes when users are online, it is not recommended, especially for radical changes like dropping and re-creating tables. If necessary, force users off and get exclusive access.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Firebird Topics