从存储过程插入临时表在 SQL 2000 中生成分布式事务错误

发布于 2024-09-04 09:10:44 字数 1549 浏览 4 评论 0原文

类似于 插入临时表去年,我从 Sql Server 2000 上的存储过程中获取了一个表,但现在出现了一个奇怪的错误。

我正在使用 Microsoft SQL Server 2000 将一个存储过程的结果转储到另一过程的临时表中。这两个过程都在同一台物理服务器上,但我收到一条错误消息,就好像第二个过程在不同的服务器上一样。

操作无法执行 因为 OLE DB 提供程序“SQLOLEDB” 无法开始分布式 交易。

代码:

    CREATE TABLE
                #subjects   (
            subject_id          INT             NULL
        ,   subject_name        NVARCHAR(500)   NULL
        ,   crm_company_id      INT             NULL
        ,   customer_no         NVARCHAR(10)    NULL
        ,   order_no            NVARCHAR(10)    NULL
        ,   order_date          DATETIME        NULL
        ,   state_code          NVARCHAR(2)     NULL
        ,   filing_office       NVARCHAR(35)    NULL
        ,   jurisdiction        NVARCHAR(200)   NULL
        ,   invoice_no          NVARCHAR(10)    NULL
        ,   invoice_date        DATETIME        NULL
        ,   invoice_status      NVARCHAR(10)    NULL
    )

    INSERT INTO #subjects (subject_id,subject_name,crm_company_id,customer_no,order_no,order_date,state_code,filing_office,jurisdiction,invoice_no,invoice_date,invoice_status)
    EXECUTE webapp.dbo.subject_search
            @SubjectName    =   @SubjectName
        ,   @StartDate      =   @StartDate
        ,   @EndDate        =   @EndDate
        ,   @CRMCompanyID   =   @CRMCompanyID
        ,   @RoleName       =   @RoleName

Similar to Insert into a temp table from a stored procedure on Sql Server 2000 from last year, but now with a strange error.

I'm using Microsoft SQL Server 2000 to dump results from one stored procedure into the temp table of another procedure. Both procedures are on the same physical server, yet I'm getting an error message as if the second procedure was on a different server.

The operation could not be performed
because the OLE DB provider 'SQLOLEDB'
was unable to begin a distributed
transaction.

The code:

    CREATE TABLE
                #subjects   (
            subject_id          INT             NULL
        ,   subject_name        NVARCHAR(500)   NULL
        ,   crm_company_id      INT             NULL
        ,   customer_no         NVARCHAR(10)    NULL
        ,   order_no            NVARCHAR(10)    NULL
        ,   order_date          DATETIME        NULL
        ,   state_code          NVARCHAR(2)     NULL
        ,   filing_office       NVARCHAR(35)    NULL
        ,   jurisdiction        NVARCHAR(200)   NULL
        ,   invoice_no          NVARCHAR(10)    NULL
        ,   invoice_date        DATETIME        NULL
        ,   invoice_status      NVARCHAR(10)    NULL
    )

    INSERT INTO #subjects (subject_id,subject_name,crm_company_id,customer_no,order_no,order_date,state_code,filing_office,jurisdiction,invoice_no,invoice_date,invoice_status)
    EXECUTE webapp.dbo.subject_search
            @SubjectName    =   @SubjectName
        ,   @StartDate      =   @StartDate
        ,   @EndDate        =   @EndDate
        ,   @CRMCompanyID   =   @CRMCompanyID
        ,   @RoleName       =   @RoleName

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只怪假的太真实 2024-09-11 09:10:44

您可以发布 subject_search 过程的代码吗?是否涉及任何链接服务器,代码中是否还有分布式事务?

can you post the code of the subject_search procedure, are there any linked servers involved, are there also any distributed transaction inside the code?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文