gpt4 book ai didi

mysql - 如何在链接服务器上将数据从mssql更新到mysql

转载 作者:行者123 更新时间:2023-11-29 03:17:38 24 4
gpt4 key购买 nike

OLE DB provider "MSDASQL" for linked server "MYLINKEDSERVER" returned message "Row cannot be located for updating. Some values may have been changed since it was last read.".

Msg 7343, Level 16, State 4, Line 1
The OLE DB provider "MSDASQL" for linked server "MYLINKEDSERVER" could not UPDATE table "[MSDASQL]".

行集使用开放式并发,并且在上次提取或重新同步包含行后更改了列的值。

DECLARE @Counter nvarchar(1024),
@TSQL varchar(8000)

SET @Counter = 0

WHILE (@Counter <=(select Top 1 ID from mydb.dbo.tbl1 order by ID desc))

BEGIN

set nocount on

IF EXISTS(select Top 1 ID from mydb.dbo.tbl1 where ID = @Counter)

BEGIN

SELECT @TSQL = 'UPDATE OPENQUERY(MYLINKEDSERVER,''select * from mydb2.tbl2 where tbl1_id is not null and tbl1_id= ' + @Counter + ''')' + 'set employees = ' + CAST((select t.employees from mydb.dbo.tbl1 as t where t.ID = @Counter) as nvarchar)

EXEC (@TSQL)
SELECT @Counter=@Counter+1
END

ELSE BEGIN

SELECT @Counter=@Counter+1

END

END

最佳答案

ODBC 驱动程序高级选项。标记为仅转发不缓存结果...返回匹配行的标志...

关于mysql - 如何在链接服务器上将数据从mssql更新到mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52475172/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com