Need ideas on possible algorithms for check ing to see if a flat file has records before I execute a truncate on the table

  • I have a pkg that currently uses a script task to check to see if the file is available, sets an ssis variable to true if it is, and I use that variable in an expression inside the precedence constraint to determine if the truncate statement inside the following execute sql task is executed or not.

    Now, I've been asked to also check to see if the file has records as well before running the truncate exesql task. The flat files have header rows in each. The only thing I can think of is adding another dataflow after my script task that checks for existing file to use a rowcount task to set the variable again and have another expression in the precedence constraint after the dataflow and before the truncate table exe sql task.

    To me this doesn't feel like the most efficient way of doing this. Any ideas would be appreciated.

  • I think you're on the right track. See if the flat file exists; if so, load flat file to a staging table. Verify that what's in the staging table is good (or good enough) to proceed; then truncate your regular table and process as you normally would.

    Rob

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

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