Update a table with Trigger on Table

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Update a table with Trigger on Table

Post by Roopanwita »

Hi,

I am trying to load a table(SQL Server 2008) using ODBC Connector Stage with load strategy : Update then Insert.

I have Trigger written on the table(Table I am trying to Update), which updates another table i.e. I am trying to Update Table_A and Table_A has a trigger Trig_A which updates Table_B .

With load strategy Update / Insert process is failing with Error :
SQLSTATE = 24000: Native Error Code = 0: Msg = [Microsoft][SQL Server Native Client 10.0]Invalid cursor state
When I perform the update from SQL server Management Studio , it is working fine (it is giving trigger updates also)

Is there a way to update the table without disabling the trigger?

Thank you for help.
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Is your ODBC Connector running in parallel? The invalid cursor state may be caused by triggered updates colliding on table B.

How many records are you processing? Can you try single-threading the ODBC Connector and see if that fixes the problem? If it does, then you've confirmed its a parallelism issue.
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
LeonHo
Participant
Posts: 4
Joined: Wed Mar 15, 2006 11:28 am

Having the same issue with ODBC Connector

Post by LeonHo »

asorrell wrote: Can you try single-threading the ODBC Connector and see if that fixes the problem?.
Hi, I am having the same error while trying to update my target.
Is there a way to force single threading in ODBC Connector stage? I do not find this option in the tabs. We're running version 8.7 of DataStage.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Run the ODBC Connector stage in Sequential mode. Set this property on the Advanced tab in stage properties.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
LeonHo
Participant
Posts: 4
Joined: Wed Mar 15, 2006 11:28 am

I think I'm missing something?

Post by LeonHo »

Thanks for the reply. It doesn't look like the option is available. Please see below screenshot.

http://farm3.staticflickr.com/2847/1263 ... 6637_b.jpg
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

It is a "stage" option, not a "link" option. In the upper left-hand corner click on the stage icon in the picture. Then look at the advanced tab for execution mode.

(Click on link in picture to go back to other options).
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
LeonHo
Participant
Posts: 4
Joined: Wed Mar 15, 2006 11:28 am

Same error experienced after setting to sequential mode

Post by LeonHo »

Hi,

Thanks for that. I am able to set the stage to Sequential now. However the same "Invalid Cursor State" still occurs, and no rows are updated in the target.

Could this be an issue with the driver?
LeonHo
Participant
Posts: 4
Joined: Wed Mar 15, 2006 11:28 am

DB Trigger was the cause

Post by LeonHo »

Hi,

We were able to get a hold of the DBA to disable the triggers. The DataStage job worked perfectly when the update triggers are inactive. In terms of # records I was only updating 5 records so I don't think it was a volume issue. I tried both a DS generated SQL and a user sql with the same results.
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

At this point you might want to call your service provider, you might actually have a driver bug. If you do resolve it, please post...
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
Post Reply