Sql-server – Data migration between databases in the same instance

migrationsql serversql-server-2005ssis

I have two almost identical (structurally) databases:

  1. Documents
  2. DocumentsOld

The original database existed before table partitioning was available, so the solution they found was to create the second database and migrate all the old data to it after each year. Now they want to merge both databases again.

I've done some research and I found that both database have just minor structure differences between tables and no IDENTITY columns.

So, aside from the minor structural differences, I'd say it'd be mostly possible to just INSERT values from the old database back to the first one.

The database is actually somewhat big and has more than 100 tables.

What I want to know is, would it make sense to use SSIS to do this, or is SSIS suited to this kind of job? Or should I just write T-SQL code to do the job?

As an additional question, are there any tools more suited than the first two options above to this kind of job?

Best Answer

I'd go straight SSIS myself. Besides having configuration, logging and error handling out of the box, you can get some really nice performance out of it.

You could probably save quite a bit of time by using something like EzAPI to script out the majority of the packages and then tweak the remaining 10%.

I recently used that approach to script out replicating ~150 tables from our Informix instance to SQL Server. Saved me a ton of time by getting the basics set up, all I had to do was fix some data type incompatibility between the systems. I'm behind on blogging about EzAPI but I could put together a sample if you're interested in the approach.

Edit

I put together an demo of replicating tables with SSIS EzAPI. You'd need to modify the values in ReplicateTables and then modify the query in GenerateTableList to ensure it's identifying all the applicable tables.