Please help with capturing @@ERROR from sql statements in DTSLookups

  • I have a Transformation task which invokes a DTSLookups (from the ActiveX script). The lookup  contains two sql statements separated by the semicolon, like this:

    update table1 set val = ? where id = ?; select @@ERROR, @@ROWCOUNT

    This is how I invoke the lookup from the vbscript:

    errorCodeArray = DTSLookups("mylookup").Execute(val1, val2)

    I also have a step to handle the "On Failure" workflow.

    Let's say for some reason the update statement in the lookup fails. As a result, my "On Failure" workflow

    will be executed. However, in my failure task, I can't seem to get the correct value of the sql error code from the @@ERROR. It gives me a 0.

    Can someone show me how to capture the @@ERROR from the failed sql statement in DTSLookups?

    any help is appreciated.

    Newbie.

  • This was removed by the editor as SPAM

  • Try assigning the results of the @@ERROR query to a global variable that the 'on failure' step can read to get the value.

    Greg

    Greg

  • Thank you very much for your response.

    But I don't see an option for me to assign @@ERROR to a global variable from within Lookup.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply