This last week I have had my head buried in a project to merge several databases into a few common ones. One of my clients is finding that a lot of smaller companies are combining their presence for various reasons and with it comes the need to merge what were previously very separate installations. Blah, blah, that is the boring stuff. What it means is that I have to do a bunch of things to make it work. These programs have a long history and as you can imagine with the “evolving” nature of vertical market software they also have a lot of baggage in their implementation. From what I have seen this is just a fact of life. It sure does make for some interesting jobs though!

If I get a chance I might try to blog about some of the other techniques I learnt while working on this project. Lots of SQL manipulations that are pretty cool, lots of mistakes and back tracks and lots of things I just wish there was a tool that could do the job for me. First though, this is something that I hacked together using powershell to rename a directory full of word documents that had a unique identifier embedded in the name.

The Situation

Two databases were being combined, Client records in database A would remain as they were. All Clients from Database B were copied into database A and received a newly generated SysID (Identity column) when they were inserted. The original SysID was stored in a column of the Clients table (ReferralSysID) for later reference. It could have been a temp table but this old ID was going to be needed for other things so it was decided to put it in the table itself.