Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

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

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, May 22, 2014 1:26 AM
Points: 6, Visits: 38
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
DECLARE @n1 int;
DECLARE @n2 int;

select @n1 = count(*) from inserted;
select @n2 = count(*) from deleted;

if (@n2>0)
delete from "SERVERNAME".DB.dbo.ddg_knude_geomtxt where id in
(select id from deleted d)

help will be apreciated SO MUCH.


Best regards
Post #1539470
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse