Avatar of spaceplanner
 asked on

SQL server trigger to update sybase database

Is it possible to write a trigger on a SQL Server table that will update data in a sybase database?

If so, how does one do it? what is the syntax

Microsoft SQL Server

Avatar of undefined
Last Comment

8/22/2022 - Mon

Create a linked server with the sybase and then use open query to update the table in sybase.

This is how you can do it
1.Create an odbc to the sysbase database
Creates a linked server, which allows access to distributed, heterogeneous queries against OLE DB data sources. After creating a linked server with sp_addlinkedserver, this server can then execute distributed queries. If the linked server is defined as Microsoft® SQL Server™, remote stored procedures can be executed.
3.Run Open Query to update the table
4.Create a trigger on orignal table  to include this openquery statement.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

this is how you can do update in open query

update openquery(LinkedServerName,  'select  LAST_UPDATE_DATE from schemax.tablex  where transaction_id = 1') set LAST_UPDATE_DATE  = 'newvalue'
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.