2

实际上我需要将 Mssql 连接到 Mysql,幸运的是我使用 MSSQL 2008 R2 链接服务器连接了 Mysql

现在,当我尝试此查询时,我想在两个数据库中一次编写一些更新查询

update products set Stock=A.Stock from
  (Select * FROM OPENQUERY(MYSQL,'Select * From products where Id=8')) A
  inner join products B on b.Id=a.Id

MSSQL 的行是从 MYSQL 更新的

我还需要将 MSSQL 更新为 MYSQL

请帮帮我,我从过去 4 天开始工作

4

1 回答 1

6

MYSQL 到 MSSQL 更新:

update products set Stock=A.Stock from
(Select * FROM OPENQUERY(MYSQL,'Select * From products')) A
inner join products B on b.Id=a.Id



UPDATE employee
SET LastName = ( Select FirstName from employee where FirstName = (SELECT * FROM
OPENQUERY(MYSQL, 'Select FirstName from employee where IndividualId=3')))

MSSQL 到 MYSQL 更新:

UPDATE OPENQUERY (database, 'SELECT Stock FROM wings.products WHERE id =1') 
SET Stock=999;
于 2012-06-13T05:17:10.513 回答