"Linked Server" with Mysql

Asked

Viewed 475 times

3

DBMS: SQL SERVER 2014 + Mysql 5.5

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

  • OPENQUERY is better option and with higher performance.

1 answer

1


There is a way, configure the RPC Out for true as in the figure below, in the properties of your Linked Server, which in this case is CONNECTMYSQLODBC:

inserir a descrição da imagem aqui

Now do so:

Obs: generics is the bank and cidades the table name

Select:

Execute('SELECT * FROM `generics`.`cidades`') at CONEXAOMYSQLODBC

Insert

Execute('INSERT INTO `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, remembering that the best solution is with Openquery.

  • 1

    Thanks! solved the problem!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.