how to check if file contains only column headers without data

  • Hi All,

    i have a task to check file (excel & text) before loading to a table.

    checking condition: if file only contains header(columns) without any data then fail the file.

    I have filename & source file path variables already - any idea how to handle this in script task?

    much appreciate!

     

  • Set up your connection manager with column headers. In your data flow task add a Row Count as the first transform in the data flow and store the count in a variable , the next transform should then be a conditional split where you read the Row Count where you can then decide what to do if it = 0 or not.

  • thanks tim,

    what i want to design is even before going to data flow i want to perform all the checks and based on the condition i have all the follow up tasks for failing the file- so in this case i have to use script task to perform this validation.

     

  • You could implement caojunhe24's suggestion in a separate data flow, store the row count in a package variable, and test it before branching to your primary data flow.

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

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