community.borland.com

Article #25610: How to copy an InterBase table's structure to a new table

Problem:
In dBase, you could copy the structure of a table to another table. 
Is there a way to do this in InterBase? 

Solution:
***************************************************************************************
Note : The information in this document will work with all InterBase versions.
***************************************************************************************
The process to create a new InterBase table with the same field names and
types as an existing table is fairly straight-forward.   All you have to do is extract 
the metadata of the origin table and create a new table with the same metadata.


Here are the steps to do it in WISQL in Windows NT.

1. Connect to the database if you are not connected already. 
             File | Connect to Database

2.  Extract metadata for table you want to copy the structure from. 
                 Metadata | Extract Table

3.  Select table you want to extract data from, using the picklist provided.

4.  Copy the create table statement.

     Highlight the create table statement that appears in the results 
     window in WISQL by either hitting shift key and using down arrow 
     to highlight the text or by clicking your mouse at the first character 
     of the create statement and holding the mouse button down as you 
     drag your mouse to the bottom of the statement.

      Hit  to copy highlighted text to the clipboard.

5. Paste the copied statement into the statement area in WISQL.

      Hit  to paste the statement in.

6.  Edit the table name in the statement to be the new table name.

7.  Click on the lightening bolt to run the statement.

Last Modified: 26-OCT-00