As a develeper and DBA, sometimes you need to deal all kinds of databases. We have been getting a lot of inquiries and requests to make MySQL OLE DB Provider capable for developers and/or DBAs like you to setup MySQL as linked server in MS SQL Server. After reading this page, we hope you will know:
If you have done some kind of linked server setup, it shall be easy for you. Here are some steps you need to follow in order to setup MySQL as Linked Server using MySQL OLE DB Provider.
If you have done some kind of linked server setup, it shall be easy for you. Here
are some steps you need to follow in order to setup MySQL as Linked Server using
MySQL OLE DB Provider.
|
|
EXEC master.dbo.sp_MSset_oledb_prop N'OleMySql.MySqlSource', 'AllowInProcess', 1 GO
Select Statement
select * from openquery(MYLINKEDSVR, 'select * from tb_alltypes')
Insert Statement
insert openquery (MYLINKEDSVR, 'select id, name, address from cust where id=0')
values(6300, 'Greg Oden', 'Rose Garden, Cherry City, OR')
Delete Statement
delete from openquery(MYLINKEDSVR, 'select id, name, address from cust') where id=4200
Update Statement
update openquery(MYLINKEDSVR, 'select id, name, address from cust order by id')
set id = 6001 where id=3201
The current implementation regarding linked server works with MySQL 5.0 or newer. There is no plan to make it also work with MySQL 4.1 or older.
To delete/update records, the select statement inside openquery must include either primary key or unique index