Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

distributet sql fired from trigger fails?? Expand / Collapse
Author
Message
Posted Saturday, February 08, 2014 12:11 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, March 31, 2014 4:07 AM
Points: 6, Visits: 37
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.
Post #1539470
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse