Fail SSIS job on empty table

  • After running a series of SSIS tasks, I want to check a table to be sure it has rows. If the row count is zero, I want the job to fail. Is there an easy way to do this in SSIS?

  • Easiest way would be to use a SQL task and run a check in it.

    If not Exists(Select count(Null) From MyTable)

    RaisError("Table is empty!", 16, 1)

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

  • Crispin Proctor (8/12/2008)


    Easiest way would be to use a SQL task and run a check in it.

    If not Exists(Select count(Null) From MyTable)

    RaisError("Table is empty!", 16, 1)

    This seems to fail the task whether or not the table is empty.

  • sorry, remove count(Null) and just have null.

    Select null from table.

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

  • Crispin Proctor (8/12/2008)


    sorry, remove count(Null) and just have null.

    Select null from table.

    That did the trick. Thanks!

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

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