question

haneesh avatar image
haneesh asked

how to update a local ms sql database when remote mssql db is updated

triggers
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

SirSQL avatar image SirSQL commented ·
You're providing no information here on what you are looking for. You could be looking at doing distributed updates using a trigger which will require a properly configured MSDTC or you could be looking at something as simple as transactional replication. You need to give further details around what you actually need before someone can provide any level of assistance.
0 Likes 0 ·
Grant Fritchey avatar image
Grant Fritchey answered
Assuming the title is the question, there are a couple of ways of doing this that I would recommend looking into. I would not suggest triggers. You're going to have to run them through linked servers and that can be very inefficient. Instead, I'd suggest you look into mirroring, which can copy one database to another. If you're running SQL Server 2012 you can use the Availability Groups which allow for read only copies in mirroring. If you need to have a read only copy but you only want to move a few tables or a few columns within some tables, then I'd look at replication. With replication procedures you can pick and choose what gets moved through replication at a very granular level. Both these topics are available in detail in the books online.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Fatherjack avatar image
Fatherjack answered
I wholly support the ideas and advice from @Grant Fritchey and would add that it might be worth investigating Service Broker as a solution. This would make sure that the updates are made, and in a consistent order but neither system is going to impact on the other within a transaction. This would assist in keeping server performance consistent. It all depends on what your system needs to achieve and what best suits your scenario.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Grant Fritchey avatar image Grant Fritchey ♦♦ commented ·
Excellent suggestion. I keep forgetting about that as an option.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.