question

ksunil avatar image
ksunil asked

After commit in a trigger, it says MARS batch is still active at the end of the batch. The transaction is rolled back

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"
mysqlms sqlbatch
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.