Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Need ideas on possible algorithms for check ing to see if a flat file has records before I execute a truncate on the table Expand / Collapse
Posted Friday, August 16, 2013 6:58 AM


Group: General Forum Members
Last Login: Friday, September 23, 2016 10:09 AM
Points: 445, Visits: 1,030
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.
Post #1485173
Posted Friday, August 16, 2013 7:15 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, August 18, 2016 9:27 AM
Points: 1,286, Visits: 1,388
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.

Post #1485190
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse