Table creation

  • I wanted to create a new table 'A1' from table 'A2' with only structue,not the data of the table 'A2'. I am o.k upto this,

    At the same I wanted to get the constraints(default,identity etc....) of the table 'A2' to table 'A1'

  • If this is a one off:

    - in Enterprise Manager, select table

    - right mouse click the table and select Generate SQL Scripts

    - in Options tab, check the Table Scripting Options check boxes including the 'Script Primary Keys, FOREIGN keys, defaults and check constaints'

    - select General Tab

    - press Preview

    - Copy and paste into Query analyser

    - remove drop statement

    - replace all occurrencues of table name with new name (Ctrl+H)

    - execute

    If you need to do this more frequently, you can get all the info from stored procedures.

    Jeremy

  • Another way is to just drag & drop your table from EM to QA, that generated the full table structure and all the constraints as a CREATE TABLE statement. You can also use DTS - Object Copy and uncheck the COPY DATA option.

    Regards, Hanslindgren

  • If you use DBArtisan, this is even simpler.

    .

  • Hi

    Thanks to all of u peole for helping me in this issue.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply