Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Delete trigger from Server A to Server B

Status
Not open for further replies.

bt7403

Programmer
Nov 5, 2006
14
US
I need to create a trigger on Server A to delete two tables on Server B. Tables are same name and replicated.
The trigger would run after replication successful on Server A.
Pls. advise on syntax for accessing Server B table from Server A.
 
You have to setup a linked server on ServerA pointing to ServerB. You can then access the objects which you have rights to using the objects four part name.
Code:
delete from ServerB.Database.dbo.TableName
Where PrimaryKey = 'SomeValue'

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
I finally did get it-forgot about 4-part notation-already had linked server.
found another interesting issue-could not run distributed queries after above completed due to MSDTC error.
Found solution on this link to correct MSDTC issue:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top