异构查询需要ANSI_NULLS和ANSI_WARNINGS-触发器处理链接服务器

时间:2018-07-19 11:39:19

标签: sql-server linked-server database-trigger ansi-nulls

尝试通过应用程序插入表时,收到以下错误消息。

  

异构查询要求为连接设置ANSI_NULLS和ANSI_WARNINGS选项。

ANSI_NULLS ON和ANSI_WARNINGS ON都没有帮助...

SET ANSI_NULLS ON
GO
SET ANSI_WARNINGS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER TRIGGER [dbo].[BenRef_UPDATE]
 ON [dbo].[ITRAEN]
  AFTER UPDATE
    AS

 BEGIN
     SET NOCOUNT ON

    IF UPDATE(poz2) 


   CREATE TABLE storeBenRef( 
      BeneficiaryRef VARCHAR(30),
      Partija VARCHAR(30) collate Serbian_Latin_100_CI_AS, 
      Datum DATETIME
     );

    INSERT INTO storeBenRef ( BeneficiaryRef, Partija, Datum ) 
      SELECT i.poz2, i.PARTIJA,i.DOTVORANJE
           FROM inserted i
             INNER JOIN deleted d 
                 ON i.PARTIJA = d.PARTIJA;


   SET ANSI_NULLS ON
   SET ANSI_WARNINGS ON


    UPDATE [EXPSRV1].[OPR].[protected].[TransferServiceArrangement] 
    SET PaymentDetailsBeneficiaryReferenceNumber = tmp.BeneficiaryRef
      FROM storeBenRef tmp
          INNER JOIN [EXPSRV1].[OPR].[protected].[TransferServiceArrangement]  
            trsa
              ON trsa.PaymentDetailsPayerAccountNumber = tmp.partija 
                   WHERE trsa.FirstPaymentDate = tmp.Datum



    DROP TABLE dbo.storeBenRef; 

        SET NOCOUNT ON;
     END; 

试图将它们放在更新语句之前,尝试分别进行设置, 但这没用。

我寻求帮助。

0 个答案:

没有答案