Thursday, March 8, 2012

Backup and restore using ssis

Hi,

I am trying to take the backup of a database, and restore it over a diff database (with same schema).

i am new to SSIS can you guys give me some pointers.

also, i would like to do a daily update of data from one table in a db to a table in another db with same schema; only the rows with latest edit time must exist, i have a column in both tables which records the last editing time of a row....

Help....

Regards

Mave

From a 50,000 foot level. If you have a time stamp value, you could store the last timestamp value processed in a table some where. When the package runs it could grab the current max timestamp value, then get all the records with a time stamp value greater than the last time stamp value and less than or equal to the current max. For each record you would perform an update or insert as appropriate (note that deletes will need to be handled another way) and finally store the current max as the last max.

For deletes you could create a table of id's and timestamps. On the table you're auditing place a trigger that just inserts the ID of the deleted records. Grab the records deleted since last run and delete them in the destination table like we did above for the inserts and updates and then save the last deleted timestamp.

Hope this helps.

No comments:

Post a Comment