script task failing the job

  • i have a script task:

    Dim fileLoc As String

    fileLoc = CStr(Dts.Variables("User::ImportLocation").Value)

    Dim fullFileName As String = fileLoc + "Prices_wp2.xls"

    If System.IO.File.Exists(fullFileName) Then

    Dts.TaskResult = Dts.Results.Success

    Else

    Dts.TaskResult = Dts.Results.Failure

    End If

    i am handling the failure of this task in my package.

    the problem is when this package is run from SQL agent it fails because the script returns a failure to the job when the file is not found.

    Any ideas how to handle this?

  • I haven't well understood your question.

    "because the script returns a failure to the job when the file is not found."...

    The script return a failure if the file is not found, no matter if it is run by SQL Agent or directly.

  • Panks (11/13/2008)


    i have a script task:

    Dim fileLoc As String

    fileLoc = CStr(Dts.Variables("User::ImportLocation").Value)

    Dim fullFileName As String = fileLoc + "Prices_wp2.xls"

    If System.IO.File.Exists(fullFileName) Then

    Dts.TaskResult = Dts.Results.Success

    Else

    Dts.TaskResult = Dts.Results.Failure

    End If

    i am handling the failure of this task in my package.

    the problem is when this package is run from SQL agent it fails because the script returns a failure to the job when the file is not found.

    Any ideas how to handle this?

    What do you wanna do??

    kshitij kumar
    kshitij@krayknot.com
    www.krayknot.com

  • Sounds like the SQL Agent service may be running with credentials which do not allow it to access the file. Is it on a network folder somewhere?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

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

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