T-SQL Copy Table To Another Database

Occasionally, you might do something stupid like run a SQL script on the wrong database, or setup your application to configure its table structure on the master DB.

When you do, here’s an easy way to copy the tables to another database (on the same server)

1
2
SELECT * INTO target_db.target_table_name
FROM source_db.source_table_name

One Response to “T-SQL Copy Table To Another Database”

  1. Brenton  on October 6th, 2009

    This will only copy the data across. There are plenty of other things you need from the table such as Indexes, Constraints and Statistics to be bought across.


Leave a Reply