[英]SQL Server 2005 DB2 Linked Server Error When Inserting Result Set into a Temp Table
We have a linked Server against DB2 on SQL Server 2005. When we tried putting a simple query result set from the linked sever into a temp table return this error. 我们在SQL Server 2005上有一个针对DB2的链接服务器。当我们尝试将来自链接服务器的简单查询结果集放入临时表时,将返回此错误。
OLE DB provider "MSDASQL" for linked server "SOMEDSN" returned message "[IBM][CLI Driver] SQL0998N Error occurred during transaction or heuristic processing. Reason Code = "16". Subcode = "2-8004D026". SQLSTATE=58005 ". 链接服务器“ SOMEDSN”的OLE DB访问接口“ MSDASQL”返回消息“ [IBM] [CLI驱动程序] SQL0998N在事务或启发式处理期间发生错误。原因代码=” 16“。子代码=” 2-8004D026“。SQLSTATE = 58005” 。 Msg 7391, Level 16, State 2, Line 21 The operation could not be performed because OLE DB provider "MSDASQL" for linked server "SOMEDSN" was unable to begin a distributed transaction.
消息7391,级别16,状态2,第21行,因为链接服务器“ SOMEDSN”的OLE DB提供程序“ MSDASQL”无法启动分布式事务,所以无法执行该操作。
DECLARE @FilterCode varchar(20);
Set @FilterCode = '11122';
Create Table #TmpTable (
Id Int
)
Insert Into #TmpTable
EXEC ('Select A.Id From SCM1.DB2TBL1 A Where A.FilterCode = ?', @FilterCode) At SOMEDSN;
The Exec works just fine with correct result set displayed, but as soon as we tried the result set into the temp table, then we get the error. Exec可以正常工作,并显示正确的结果集,但是一旦我们将结果集尝试到temp表中,我们就会收到错误消息。
I searched here and many other places and tried the followings. 我在这里和其他许多地方搜索并尝试了以下方法。
The table contains very many rows. 该表包含很多行。 We need to execute the query on the DB2 side to reduce the result set based on the parameter.
我们需要在DB2端执行查询以减少基于参数的结果集。
Any help would be greatly appropriated! 任何帮助将不胜枚举!
Have you started the MSDTC service (DTC)? 您是否已启动MSDTC服务(DTC)?
Under Windows 2008: 在Windows 2008下:
If that does not work, try disabling connection pooling . 如果这样不起作用,请尝试禁用连接池 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.