gpt4 book ai didi

sql - 插入表中.. 链接服务器上的 exec 不起作用

转载 作者:行者123 更新时间:2023-12-04 22:25:09 25 4
gpt4 key购买 nike

这有效,返回结果集:

exec ('select ''col'', count(1) from test.dbo.[Table1] with (nolock)') at svrA

当我尝试将结果集插入表中时:
insert into rowcount_sub (tablename,rowcnt)
exec ('select ''col'', count(1) from test.dbo.[Table1] with (nolock)') at svrA

失败给出这个错误:
OLE DB provider "SQLNCLI10" for linked server "svrA" returned message "No transaction is active.".
Msg 7391, Level 16, State 2, Line 1
The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "svrA" was unable to begin a distributed transaction.

最佳答案

The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "svrA" was unable to begin a distributed transaction.



该消息非常清楚且非常明确。您所要做的就是打开系统文档并按照配置分布式事务的步骤操作: Configuring MS DTC Services

还有很多博客和教程:
  • How to configure DTC on Windows 2003
  • How to configure DTC on Windows 2008
  • 关于sql - 插入表中.. 链接服务器上的 exec 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4360467/

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