Often, when you are creating a new table, you wish to copy the definition of an existing table. This is generally done for two reasons:
To copy an existing table definition, click on the Copy From button and select the table you wish to copy. Note that the Copy From button will only be visible when you are in Create mode.
You will be asked Do you want to copy Indexes, Keys and other related objects? If you reply No, AQT will just copy the column-list and table properties. If you reply Yes, all attributes of the table will be copied, including primary key, indexes, foreign keys, views, aliases, triggers and authorities.
For many database types, the names of the Primary Key, Indexes, Foreign Keys, Constraints, Views, Aliases and Triggers are unique throughout the database. If you copy these definitions from another table, you will need to change the name of these objects before you create them. If you do not do this, they will fail to be created as objects with these names already exist.
You can copy the definition of a table from either the same database or another database. The other database can be of a different type. For instance, you can create a table on Oracle, copying the definition from a SQL Server table. When you do this, AQT will:
In most cases this is only partially successful. Most databases have attributes which aren't present in other databases. For instance, when copying the definition from SQL Server to Oracle, the tablespace, logging, percent free and other Oracle attributes will not be set, as SQLServer tables have no such corresponding attributes.
When copying a table definition from another database, the table and column names will come across in style as per the database you are copying from. Often you may wish to change to another style of name.
If you go Edit > Change Table/Column Names, you have the option of changing the table and column names to another style.
The following is the example of these styles for column CUSTOMER_CODE:
Style |
Column Name |
Description |
Oracle / DB2 names |
CUSTOMER_CODE |
Upper case with underscores between words |
SQL Server names |
CustomerCode |
Capatalized with nothing between words |
Access names |
Customer Code |
Capatalized with spaces between words |
This only changes the names of your tables and columns; the names of your primary keys, indexes etc are not changed.