SQL Server 2005 SQLAgent Triggers - mysql

I need to set up a SQL Server trigger to connect to a remote mysql linux server and insert data into a table. Is there a way to do this?
I'm leaning towards triggers rather than scheduled tasks because the trigger will execute each time data is entered/updated in the SQL Server table and only 1 record will be passed to the MySQL table at a time, cutting down on large data transfers and creating a more 'realtime' transfer appearance.

You don't need a trigger for this.
Create a linked server to the remote server, create a stored procedure to insert the data into the linked server and then schedule a task under SQL Agent to run the stored procedure.
Writing a Stored Procedure
How to: Schedule a Job

Related

Auto Sync the Sql server table to MYSQL table

I need to auto sync some tables in SQL server(inside corporate network) to remote MySQL server. I wrote a script when it runs it copies the data from SQL server to remote MySQL server. Is there any other way alternate to scheduled script. I found some suggestions like triggers but I don't know whether trigger works in this situation.

Transfer Data from Local MySQL server to remote SQL server?

I need to make a procedure or find a solution in order to copy, at the end of each day, data that was added to my local MySQL server over to a Remote SQL server.
I am likely going to code a small app in .net to simply pull the data from the local MySQL server and insert it into the Remote SQL server, and just run the app on a schedule.
However, If I can avoid doing this and move the data with a procedure or a job that would be preferable.
Any suggestions for a solution?

Updating MySQL with data from MS SQL Server

In MySQL is it possible to execute an update query with values selected from external MS SQL database?
I would like to execute every night a timed query, which updates some the data in MySQL with data on MS SQL server.
Typically how you would do this is, create a SSIS package (dts) that pulls the data in and does anything else you want to do. Then setup a SQL job to run the package, then Setup a A SQL batch to kick off the job whenever you want it to run

Transfer sql server data to mysql database using program

I have an old system with sql server database. And I have to create a webiste with mysql database. The old system is still in use and is inserting data to the sql server DB everyday. So, I am thinking write a program that automatically transfer data from the sql server DB to the mysql DB. Any good suggestions? Thanks.
You have an active SQL Server database.
Unless you are planning to decommission this database server (for very good reasons not related to this new application), then the new application should simply query this server.
You can create a small (Maybe in c#) program that keeps running all the times with a timer, and on this timer, get all rows from SQL server that are not marked as "Copied", insert them on MySQL and the update those rows as "Copied". That program need to have access to both databases.

The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction

Background:
We have a website that was developed under.NET framework 2.0 and it uses a database created with Sql Server 2005. And we also have a website that was developed under .NET framework 4.0 and this one uses a database created with Sql Server 2008. We linked both databases (from Sql Server 2005 to Sql Server 2008) creating a “linked Server on the Sql Server 2005 database”.
Scenario:
When we create a record on the database hosted in Sql Server 2005 we have this sequence of transactions:
Insert the record into the table hosted in the Sql Server 2005 database.
This insertion executes a trigger after inserting.
Inside the trigger, we execute a stored procedure (hosted in Sql Server 2008 database), and this stored procedure is executed by using the “linked Server”.
This stored procedure performs an insertion into a table hosted in the Sql Server 2008 database.
If we manually execute the insertion into the table hosted in Sql Server 2005 database using the Sql Server Management Studio 2005, everything gets executed well, but if we try to create the record using the UI of the web site (.NET 2005) we get this error:
The current transaction cannot be committed and cannot support operations that write to the log file. Roll back the transaction.
The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.
Does anyone know what is happening?
I do find very risky to execute such code in trigger. I would consider removing trigger and creating procedure that executes actions described.
And to test correctly everything you should either call DML action in one transaction on both servers or you should begin distributed transaction explicitly by calling "begin distributed tran". If you just update something on other server (only 1 action) you are not using distributed transaction and test is not correct.