Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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
Author
Message
Posted Friday, August 16, 2013 6:58 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, July 18, 2014 1:57 PM
Points: 313, Visits: 715
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: Yesterday @ 9:06 AM
Points: 1,166, Visits: 1,192
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
Post #1485190
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse