tags:

views:

78

answers:

1

I had to restore may database to 1 day erlier, so My database is missing data from a day before, and this databse has been used by users since the restoration.

How do I generate script/stored procedure to copy just the missing data from the backup database into my current database.

There are PK and FK relationships that need to be considering. I'm using SQL server 2005

Thanks for your help.

Aein

+4  A: 

If there are many tables, this will be a chore to write. I would suggest using a data comparison tool such as Red-Gate's Data Compare. The amount of time you will spending writing a synchronization script will cost much more than simply buying a tool that will do it for you. (No, I do not work for Red-Gate).

Thomas
thanks..I can see that's a really big project..Is there a tool in SQL server 2005 to do that?
aein
nope Red-gate's data compare ids really your best bet. It will pay for itself just on this project alone and if you one need one license the price isn't that bad.
HLGEM
@aein - Unfortunately, there is no data comparison tool in SQL Server 2005 (or 2008).
Thomas
I'm affraid buying a tool is not the way my boss wants..I really do need to write a synchronization script.If you have ideas of how to write it, examples would be greatly appreciated.Thanks a lot,aein
aein
@aein - It could take hours, perhaps days, to write and test such a script. There is no silver bullet magic solution that anyone could provide in this forum that would be anywhere near as good as using a third-party tool. Your boss is being pennywise and pound foolish. Keep in mind that RG Data Compare will create the script for you if you want and you can run it manually.
Thomas