"Linked Server" with MySQL

3

DBMS: SQL SERVER 2014 + MySQL 5.5

What are the SELECT, INSERT, and UPDATE syntax instead of using the "OPENQUERY" function, when connecting through the SQL Server Linked Server, connecting to MySQL?

    
asked by anonymous 06.06.2014 / 14:17

1 answer

1

There is a way, set RPC Out to true as in the figure below, in the properties of your Linked Server, which in this case is CONEXAOMYSQLODBC :

>

Nowdoso:

Note:genericsisthebankandcidadesthetablename

Select:

Execute('SELECT*FROM'generics'.'cidades'')atCONEXAOMYSQLODBC

Insert

Execute('INSERTINTO'generics'.'cidades'('ufid','cidade')VALUES(1,"ROSANA")') at CONEXAOMYSQLODBC 

Update

Execute('UPDATE 'generics'.'cidades' SET 'cidade'="Presidente Venceslau" WHERE 'cidadeid'=10') at CONEXAOMYSQLODBC

Delete

Execute('DELETE FROM 'generics'.'cidades' WHERE 'cidadeid'=10') at CONEXAOMYSQLODBC

But remember that the best solution is with OpenQuery .

    
07.06.2014 / 18:22