File Exists

  • Hi, in the database master there is one store procedure that valid if a file exists or not.

    How can i do it in integration services?

    Thanks,

  • simplest way i can think of is to create a script task and use the system.io.file.existst() method

  • I agree... Use a script task if you want to control the program flow based on the existence of a file, and force your script task to a status of Failure if it does not exist. You can then use the precedence constraint for failure to handle program flow if the file doesn't exist.

    The script would go something like this:

    Public Sub Main()

    Dim theFileExists As Boolean = System.IO.File.Exists(Dts.Variables("YourFilenameVariable").Value.ToString())

    If (theFileExists = False) Then

    Dts.TaskResult = Dts.Results.Failure

    Else

    Dts.TaskResult = Dts.Results.Success

    End If

    End Sub

    hth,

    Tim

    Edited 3/3 for clarity.

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

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