count

  • i created ssis package which has data flow component and the added row count component after datasource. Now i need to fail the package if rowcount variable value is less than zero.

  • This is not a particularly elegant solution, but it should work.

    Define the variable to hold the row count at the control flow level.

    Add an extra data flow at the start of the control flow that contains only your data source and a row count transformation that sets the control flow scope variable = to the row count.

    Next in the control flow, have a data flow that uses the same data source as the first one, followed by a conditional split that evaluates the row count variable. This needs to be done in a separate data flow from the count, as per msdn:

    "the value of the variable is not updated in time to use the updated value in the data flow that contains the Row Count transformation. You can use the updated variable in a separate data flow."

    If the count is less than a desired value, branch to a script component that does nothing but throw an exception.

    If the row count value is acceptable, continue as normal with your data flow.

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

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