how to check no of rows in a table, then decide stop execution or pass through

  • Hello All,

    from different sources we get data to one Database table,

    in our SSIS package, it needs to be write all the above table data to a .csv file, then it clears the table(by using execute sql task)

    now the problem here is, when there is no rows in table then it is creating 0 rows .csv file, how to check if there is atleast 1 row in table then create csv file ,otherwise (if zero rows) it shouldn't

    could some one help me in reragds to this solution

    can any one tell me is Row count helpful to me (if yes can u please direct me..)

    ,or any other solution

    please i am really stucked here

    Thanks in advance

    asini

  • Can you add another ExecuteSQLTask that executes the query:

    SELECT ? = TOP 1 1 FROM

    create a variable for the ? and change the resultset of this execute sql task to Single Row.

    Use this after your main Execute SQL Task (which inserts into your table)

    Use expression (only) on the flow - something like: @VariableName == 1

    Only on the success shud it create the csv (i.e. connect to the create csv task).

    Hope this helps.

  • vishal.gamji (2/3/2009)


    Can you add another ExecuteSQLTask that executes the query:

    SELECT ? = TOP 1 1 FROM

    create a variable for the ? and change the resultset of this execute sql task to Single Row.

    Use this after your main Execute SQL Task (which inserts into your table)

    Use expression (only) on the flow - something like: @VariableName == 1

    Only on the success shud it create the csv (i.e. connect to the create csv task).

    Hope this helps.

    SELECT ? = TOP 1 1 FROM TableName

  • vishal.gamji (2/3/2009)


    vishal.gamji (2/3/2009)


    Can you add another ExecuteSQLTask that executes the query:

    SELECT ? = TOP 1 1 FROM

    create a variable for the ? and change the resultset of this execute sql task to Single Row.

    Use this after your main Execute SQL Task (which inserts into your table)

    Use expression (only) on the flow - something like: @VariableName == 1

    Only on the success shud it create the csv (i.e. connect to the create csv task).

    Hope this helps.

    Sorry use this:

    SELECT TOP 1 ISNULL(1, 0) FROM sysobjects

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

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