Re: Copy table?
There are two main ways I'd consider, one may be better than the other
depending on how much your new table differs from the current table.
Using EM - script out the existing table using right mouse click on the
current table - All Tasks - Generate SQL script. Either save script to file
or preview and copy to clipboard then past to QA. NB if you want indexes,
constraints, triggers etc. you'lll have to turn the appropriate options
under the 'options' tab of the Generate SQL scripts dialogue box.
You will then have SQL that you can change BEFORE you create the new table.
The other, probably quicker (depending on your typing speed) method is to
type into QA the following SQL.....
SELECT * INTO <new table name> FROM <current table name> WHERE 1=2<
You can then change the structure as you like using EM.
The WHERE clause ensures no data is copied.
Hope this helps.
Regards,
Tim Gordon-Jones BSc(Hons), MCDBA
Professional Database Solutions
Web: http://www.pdbsolutions.co.uk
"SLE" <infoNOSPAM@proit.be> wrote in message
news:3ddb4a74$0$190$ba620e4c@n
ews.skynet.be...
> Hi there,
>
> I need to create a new table which has [almost] the same structure as an
> existing table, in the same database. As both tables have a large amount
of
> columns, I wanted to copy (save as) the original table into the new one
and
> adjust some column definitions afterwards. How can I copy/save as an
> existing table into a new one (no need to copy the data of course) using
EM
> or QA?
>
>
> Thanks,
>
> --
> SLE
>
>
Report this post to a moderator
|