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 2012 Forums
 Transact-SQL (2012)
 Transaction Rollback with two server connections

Author  Topic 

swissivan
Starting Member

30 Posts

Posted - 2013-04-23 : 22:43:38
I would like to update records on two server simutaneously,
error on any update statement would cause another to rollback.

I searched on web and
I would like to use
a) Linked server
and
b) ROLLBACK TRANSACTION in store procedure

1) Is this the best way to do transaction rollback?
2) Is that MSDTC must be enabled and firewall port 135 need to be opened when using Linked server in store procedure?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-24 : 01:35:50
is it straight update? ie is the table structures in both servers same? if yes, isnt it enough to enable replication between them to pick up the changes automatically? if you want near to realtime sync up use transaction replication.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

swissivan
Starting Member

30 Posts

Posted - 2013-04-24 : 03:29:20
quote:
Originally posted by visakh16

is it straight update? ie is the table structures in both servers same? if yes, isnt it enough to enable replication between them to pick up the changes automatically? if you want near to realtime sync up use transaction replication.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs




Thanks for your reply, the table structures in servers are not the same and I just want to share one of the tables, any suggestion? thanks.

Database structure similar to the following illustration:

ServerA
-DatabaseA
--Table1
--Table2
--Table3
--Table5
-DatabaseB
-...etc...

ServerB
-DatabaseA
--Table4
--Table5
-DatabaseB
-...etc
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-24 : 07:22:26
i was not refering to database structure but what i was asking on was on the table structures. if corresponding tables are same in structure you could use replication. other wise you've write a process which will run according to schedule and does this update on backend based on update on corresponding table on main server. But there'll be a obvious delay before which the data changes will get applied

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

swissivan
Starting Member

30 Posts

Posted - 2013-04-24 : 21:20:02
quote:
Originally posted by visakh16

i was not refering to database structure but what i was asking on was on the table structures. if corresponding tables are same in structure you could use replication. other wise you've write a process which will run according to schedule and does this update on backend based on update on corresponding table on main server. But there'll be a obvious delay before which the data changes will get applied

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs




Thanks again.
The only one table I need to synchronize is in the same table structure.
Will replication affect other tables? Thanks.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-25 : 00:51:55
nope...replication wont affect others. you'll explicitly select the tables that should be included in the publication for replication

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

swissivan
Starting Member

30 Posts

Posted - 2013-04-25 : 01:52:31
Thanks.
I will try replication soon.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-04-25 : 02:09:35
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -