SQL JOB to Update all tables

Go To StackoverFlow.com

0

I am using Microsoft SQL Server 2008 R2.I have copied database A(myproduction database) to database B(Myreportin database) by creating SSIS package.Both databases are in same server.I want to run a job so that If any change(data modifications like inserting new rows or updating values of any row in any table) take place in database A that will also take place in my B database and sql job will run and acomplish the changing automatically.I don't want that in database B table will be dropped and recreated (as its not our business rule )instead only the change will take place.

Can any one help me please.Thanks in Advance.

2012-04-05 15:30
by vigilant
This is a job for a trigger. The simplest way is to have one on each table you want to synchronize - NoName 2012-04-05 15:34


0

I would suggest that you investigate using replication. Specifically, transactional replication if you need constant updates. Here's a bit from MSDN:

Transactional replication typically starts with a snapshot of the publication database objects and data. As soon as the initial snapshot is taken, subsequent data changes and schema modifications made at the Publisher are usually delivered to the Subscriber as they occur (in near real time). The data changes are applied to the Subscriber in the same order and within the same transaction boundaries as they occurred at the Publisher; therefore, within a publication, transactional consistency is guaranteed.

If you don't need constant updating (that comes at a price in performance, of course), you can consider the alternatives of merge replication or snapshot replication. Here's a page to start examining those alternatives.

2012-04-05 15:42
by DOK
Thank you for your quick answer.I need constant updating of any change of value .(the update should take place once in a day 10:00 pm as we run the job 10:00 pm. But I am not allowed to do replication for this task. AS they already created a SSIS package and they want to run the package as a scheduled job.I am allowed to add new job where I can write T-SQL query - vigilant 2012-04-05 18:25
Ads