Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Handling development and production data

Author  Topic 

mcleanap
Starting Member

3 Posts

Posted - 2009-02-17 : 21:16:03
Hi,

Not sure if this is the proper forum for this question. If not, please move to the appropriate one.

We have a development and production database. Obviously this works ok for the most part. A client of ours wanted to be able to work on "production" data without actually doing it on production, so we created a 3rd database that copied the production database.

So, over a year, they have done work on this 3rd database. Created new records, updated, and deleted. Meanwhile, on the actual production database, things have gone on as normal. Again, new records created, updated, and deleted.

The time has come where they want to take some of the data on this 3rd database and put it on the production data. It's basically a subset of records....say 1800 of them from the main table, and this table joins to about 10 others. So for any of the records that already exist in the production, they want to update...and new ones, create the new ones on production.

The problem is that since work was done on the actual production all this time. In the lookup tables, there are Primary Key IDs that have been already used in both since they were identities.

So for example at the time the data was copied to the 3rd database a lookup table would look like this:

Production Categories Table (PK ID, Name)
1. Baseball
2. Hockey
3. Tennis
4. Rugby
5. Basketball

So then after the production Categories Table would be:
1. Baseball
2. Hockey
3. Tennis
4. Rugby
5. Basketball
6. Football
7. Curling

Then on the 3rd database, it would look like:
1. Baseball
2. Hockey
3. Tennis
4. Rugby
5. Basketball
6. Golf
7. Boxing
8. Football

So the problem is that for the same Primary Key ID, the values are different.

I know it's probably not explained the greatest, but hopefully someone will understand enough to guide me through this. If anyone has done something like this before, I would be grateful to hear about it.

Thanks.




darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-02-18 : 10:20:53
Are you actually using autonumbers for primary keys or is this a simplified example? If you can give some scripts to recreate some of the main tables it may be helpful. For example are Names in the Category Table unique?
Go to Top of Page
   

- Advertisement -