i'm try to update table in linked server using procedure and trigger
create trigger ksunil on testingtable
after update
as
declare @jid nvarchar(50);
declare @mid nvarchar(50);
declare @jmcredit nvarchar(50);
declare @aid nvarchar(10);
print 'begin update';
select @jid= inserted.id from inserted
print 'testingtable id'+@jid;
select @jmcredit = inserted.cpoint from inserted
print 'testingvalue credit'+@jmcredit;
set @mid = (select mid from testingtable2 where jid = @jid)
print ' table2 id'+@mid;
begin
if update(cpoint)
begin
set XACT_ABORT ON
COMMIT
execute updatecredit @jid = @jid, @mid = @mid, @jmcredit = @jmcredit
begin tran
end
end
go
create Procedure updatecredit
@jid nvarchar(50),
@mid nvarchar(50),
@jmcredit nvarchar(50)
as
DECLARE @SQLQUERY NVARCHAR(MAX);
UPDATE OPENQUERY (MYSQL, 'SELECT * FROM database2.testing WHERE id = 12')
SET credit = ''+@jmcredit+'';
print 'finish updating';
this trigger and procedure works fine, but when we try to update value from frontend it will through this error
**"A transaction was started in a MARS batch is still active at the end of the batch. The transaction is rolled back"**
can you please tell me how to fix this error.
"MARS batch is still active at the end of the batch. The transaction is rolled back"
↧