Results 1 to 5 of 5
  1. #1
    Join Date
    May 2004
    Posts
    144

    Unanswered: copy a table structure

    hi
    how can i copy a table structure from a database to another(without bakup)?

  2. #2
    Join Date
    Apr 2004
    Posts
    10

    Export

    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.

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i think this also might work:

    select * into database2.table from database1.table1 where 1=0
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    May 2004
    Posts
    144
    i want somethin like this:
    Code:
    CREATE table mytable_copy AS
    SELECT * from originaltable ;
    that works in mySQL, but in msSQL i got this error msg:
    Code:
    Incorrect syntax near the keyword 'as'.
    Last edited by bono56; 10-22-05 at 06:36.

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    congrats for resurrecting a one year old thread

    did you actually try the sql in post #3?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •