DTS Error handling....

  • Hi,

    I have this peice of VB that imports data from a spreadsheet.

    It's on a SQL Server 7 box.

    It works ok but the DTS crashes if the spreadsheet can't be imported.

    How do I capture the error and make sure it goes down the error path that it doesn't end up going down.

    Any help welcome,

    Eamon

    --------------------------------------------------------------

    Dim sql

    Set pkg = DTSGlobalVariables.Parent

    Set tsk = pkg.Tasks("DTSTask_DTSExecuteSQLTask_6")

    Set cus = tsk.CustomTask

    sql = "INSERT INTO ..................."

    cus.SQLstatement = sql

    Main = DTSStepScriptResult_ExecuteTask

    Main = DTSTaskExecResult_Success

    --------------------------------------------------------------

  • Is this VBScript, or part of a compiled VB program?

    You should be able to handle errors like this pretty easily using workflow within the package. Also, make sure that 'Fail Package on First Error' in the package properties and 'Fail Package on Step Failure' in the steps workflow properties are not selected.

    With these settings the "Main = DTSTaskExecResult_Success" line will signal success and it'll be like your package never had an error. Be sure that you have adequate error handling in place though, otherwise your package could fail and you won't know about it

     

    --------------------
    Colt 45 - the original point and click interface

  • Yes, its a VBSCript and it doesn't capture or report an error.

    any help welcome,

    Eamon

  • Why would you be doing this in VBScript ?? Why not use a plain and simple Datapump from the Excel spreadsheet into the table?

    Prior to the datapump, or even in a workflow script, you could have an ActiveXScript task that checks for the existence of the file.

     

    --------------------
    Colt 45 - the original point and click interface

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

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