SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Transaction Rollback with two server connections
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

swissivan
Starting Member

30 Posts

Posted - 04/23/2013 :  22:43:38  Show Profile  Reply with Quote
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

India
52325 Posts

Posted - 04/24/2013 :  01:35:50  Show Profile  Reply with Quote
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 - 04/24/2013 :  03:29:20  Show Profile  Reply with Quote
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

India
52325 Posts

Posted - 04/24/2013 :  07:22:26  Show Profile  Reply with Quote
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 - 04/24/2013 :  21:20:02  Show Profile  Reply with Quote
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

India
52325 Posts

Posted - 04/25/2013 :  00:51:55  Show Profile  Reply with Quote
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 - 04/25/2013 :  01:52:31  Show Profile  Reply with Quote
Thanks.
I will try replication soon.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 04/25/2013 :  02:09:35  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.04 seconds. Powered By: Snitz Forums 2000