I'm using linked server in ms sql to connect jiwa database to mysql database,
connection is successfull and now we need that whenever a user apply credit limit in jiwa it will be reflect on magento tables as well,
this is a testing trigger, after some research i found that we need to add "begin tran" before end of the trigger to avoid error like "Batch is aborted",
but now it will start giving this error in jiwa "Transaction that was started is MARS Batch is still active"
- Code: Select all
CREATE TRIGGER Creditlimit on DB_Main
after update
as
declare @jid nvarchar(50);
declare @mid nvarchar(50);
declare @jmcredit nvarchar(50);
declare @aid nvarchar(10);
select @jid= inserted.DebtorID from inserted
print 'jiwa id'+@jid;
set @aid = 167;
select @jmcredit = inserted.CreditLimit from inserted
print 'jiwa credit'+@jmcredit;
if update(CreditLimit)
begin
set @mid = (select Contents from DB_CustomSettingValues where DebtorID = @jid)
print ' magento id: '+@mid;
set XACT_ABORT ON
commit
UPDATE OPENQUERY (MYSQL, 'SELECT * FROM mysqldatabase.customer_entity_decimal')
SET value = ''+@jmcredit+'' where entity_id=''+@mid+'' and attribute_id=''+@aid+'';
begin tran
end
go
can you please let me know any fix for this error, is there any other way for work around it.
Thank you in advance