Sql-server – Moving tables to another SQL2008 database (including indexes, triggers, etc.)

migrationsql serversql-server-2008

I need to move a whole bunch (100+) of large (millions of rows) tables from one SQL2008 database to another.

I originally just used the Import/Export Wizard, but all the destination tables were missing primary and foreign keys, indexes, constraints, triggers, etc. (Identity columns were also converted to plain INTs, but I think I just missed a checkbox in the wizard.)

What's the right way to do this?

If this were just a couple of tables, I would go back to the source, script out the table definition (with all indexes, etc), then run the index creation portions of the script on the destination. But with so many tables, this seems impractical.

If there wasn't quite so much data, I could use the "Create Scripts…" wizard to script out the source, including data, but a 72m row script just doesn't seem like a good idea!

Best Answer

Scripting out the tables, then using SSIS to transfer the data would be the most reliable and effective way of moving the data to the new database.