SSIS :: HOW TO: Check if a flat-file has records in it

  • I have a series of packages that BULK INSERT millions of rows of data from flat files, when it comes across a bad record I don't want the entire thing failing, rather write it out to a flat file on the file system (let's say c:\ssis\err-output.txt)

    During the import of my flat file source, I have the success connector going to the Derived column component, and the failure to redirect rows to this err-output.txt connection manager - this appears to be working fine.

    Here's what I would like to know how to do: After everything has completed, how can I check the file to see if there's any new records in the file and then email it out if there's records?

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • If I got your problem correctly then this is the One way to do that:

    Write the last modified date in your err-output.txt file. Then at the end of your package read the error file for file names and compare if last modified date changes in any of those file.

    If any file got updated during the period of run then its last modified date will also change. 😎

    __________________________________________
    ---------------------------------------------------
    Save our mother Earth. Go Green !!!

  • I would add a record counter to the error stream. Once done, check the value. If it's more than zero, you have errors.

  • How would I go about adding that (forgive me but I'm not that accustomed to SSIS yet)

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • First create a package level variable. Insert a row count transformation between the start and end points of the data flow. Assign the output to the variable that you have created.

    If that's not enough, google SSIS Row Count for the details.

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

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