SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


distributet sql fired from trigger fails??


distributet sql fired from trigger fails??

Author
Message
ckri
ckri
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
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
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search