Link to home
Start Free TrialLog in
Avatar of mebster82
mebster82Flag for United States of America

asked on

Getting Error When Inserting Data in Linked DB2 server from a Linked Server

Hi,

I created a update trigger on a sql table  in my sql server to insert records in a  linked server DB2 table.   Insert Query works fines when I run it separately. However it doesn't work when I run it in the trigger.
However I get an error below

'The operation could not be performed because OLE DB provider "IBMDASQL" for linked server "AS400" was unable to begin a distributed transaction.'
ASKER CERTIFIED SOLUTION
Avatar of Steve Wales
Steve Wales
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mebster82

ASKER

I can insert records fine when I execute the stored procedure in the regular query window However,  it give me an error when I am calling the stored procedure in a trigger.
We're a little outside my area of expertise now, but I did find this after a search:

http://www.sqlvillage.com/Articles/Distributed%20Transaction%20Issue%20for%20Linked%20Server%20in%20SQL%20Server%202008.asp

There were several other article I found where it mentioned correct configuration of the Distributed Transaction Coordinator.

Have you verified that it's set up correctly?

There may also be transaction implications when running it in a trigger as opposed to doing an insert in SSMS.
Make sure that the stored procedure is in the corrected schema.

Also check the ownership of the stored procedure.

Check to make sure that the stored procedure is accessing the tables that you think it should.  That is, qualify the table names.
You are right. Distibuted transaction such as insert won't be supported in linked AS400 environmentl.  Work around is to create a AS400 stored procedure and call that  As400 stored procedure inside the trigger.