Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
dndaughtery
dndaughtery
SSC-Addicted
SSC-Addicted (456 reputation)SSC-Addicted (456 reputation)SSC-Addicted (456 reputation)SSC-Addicted (456 reputation)SSC-Addicted (456 reputation)SSC-Addicted (456 reputation)SSC-Addicted (456 reputation)SSC-Addicted (456 reputation)

Group: General Forum Members
Points: 456 Visits: 1071
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.
robert.gerald.taylor
robert.gerald.taylor
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1332 Visits: 1399
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search