这有效,返回结果集:
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.
由于链接服务器“ svrA”的OLE DB提供程序“ SQLNCLI10”无法开始分布式事务,因此无法执行该操作。
消息很清楚也很明确。您所要做的只是打开系统文档,然后按照配置分布式事务的步骤进行操作:配置MS DTC服务。