views:

78

answers:

2

A fun question for a Friday afternoon, no?

As the question states, is it possible to write a SQL Server trigger that inserts data into a MySQL table?


EDIT: Yes, I know this is basically a dumb idea and that the application should be doing it and so on. But this is a legacy Classic ASP application which we're transitioning to MySQL; and until we get rid of the ASP bit we really would like to be able to squirt data over to the MySQL system without touching the ASP code.

For there be dragons. Just mentioning it tends to make it crash.

Thanks all!

+2  A: 

In order to write data to a different database from SQL Server, you'd have to first create a linked server instance on SQL Server pointing to the other db (MySQL in this example) with appropriate credentials/permissions.

OMG Ponies
OK, so how would I go about this? (I'm a developer, not a database expert, so excuse me!)
Jeremy McGee
SQL Server - Linking Servers: http://msdn.microsoft.com/en-us/library/ms188279.aspx
OMG Ponies
Also see: http://www.packtpub.com/article/mysql-linked-server-on-sql-server-2008
RickNZ
@RickNZ Thanks! That one looks perfect - we'll give it a whirl.
Jeremy McGee
+1  A: 

One way to do this would be to use SQL CLR. You could have a CLR stored procedure or function that accesses the MySql DB.

RickNZ
I've been thinking about that....
Jeremy McGee