distributet sql fired from trigger fails??

  • Hi ...

    Between LINKED sqlserver 2008 R2 on win7 client (A) and sqlserver 2008 R2 (B) I can execute T-sql from query builder in A using select, delete and inserts toward B .... everything is fine.

    But when I try the same sql in a trigger (on DELETE, INSERT) on A it fails.

    Both delete and insert result in following message:

    OLE DB provider "SQLNCLI" for linked server " " returned message ""The transaction has already been implicitly or explicitly committed or aborted .".

    Msg 7391, Level 16, State 2, Line 40

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

    I have configured MSDTC on both computers to allow incoming and outgoing and no authentification - same result when trigger fires.

    The trigger is:

    CREATE trigger [dbo].[DelKnudeGeomDistributed]

    ON [dbo].[ddg_knude_geomtxt] FOR DELETE

    AS

    BEGIN

    DECLARE @n1 int;

    DECLARE @n2 int;

    select @n1 = count(*) from inserted;

    select @n2 = count(*) from deleted;

    if (@n2>0)

    BEGIN

    delete from "SERVERNAME".DB.dbo.ddg_knude_geomtxt where id in

    (select id from deleted d)

    END

    END

    GO

    help will be apreciated SO MUCH.

    Thanks.

    Best regards

    Christian.

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply