How to update row on SQL server using linked MySql server

I created a linked server between sql server and mysql . It will work great for me. My question is when insert row in mysql table at this time I want to update row in sql server table,

As in the mysql table name 'abc', when in this table a new row inserts this time into the sql sqs xyz table name and in this field the default status name is true and when a new row is inserted into the abc table of that time in xyz the status table field name will be automatically updated, and the status will change to false.

My linked server name is MYLINK and it will work fine for me, I want to create trigger which update row in sql server and how to create trigger for update line on sql ms server.

+4
source share
2 answers

mysql cannot run anything but mssql. But you can use SQL Agent to schedule a task running on sql server, to select data from the associated mysql

+1
source
 ALTER TRIGGER [TriggerLocalServerTable] ON dbo.[LocalServerTable] FOR INSERT AS DECLARE @A varchar(4) DECLARE @B varchar(4) DECLARE @id int BEGIN SELECT @A = A, @B = B, @id = id FROM inserted UPDATE [LinkedServer].[Database].[dbo].[Table] SET A = @A, B = @B WHERE id = @id END 
+1
source

Source: https://habr.com/ru/post/1495908/


All Articles