Wednesday, March 7, 2012

copy a table structure

hi
how can i copy a table structure from a database to another(without bakup)?Right Click on the table in Enterprise manager go, All Tasks, Generate SQL Script.

Then Click formatting tab, make sure that generate CREATE is the only script generated then...

Options, Script Indexes, Script Triggers, Script PRIMARY Keys, Foreign Keys.. Check on.

Hope this helps.|||i think this also might work:

select * into database2.table from database1.table1 where 1=0|||i want somethin like this:

CREATE table mytable_copy AS
SELECT * from originaltable ;

that works in mySQL, but in msSQL i got this error msg:

Incorrect syntax near the keyword 'as'.|||congrats for resurrecting a one year old thread

did you actually try the sql in post #3?

No comments:

Post a Comment