I agree that your five lines of code is quite simple. But there is still the fact that it might FAIL the task, and if the OP is not careful, he'll get a surprise error the first time he runs the package from SQL Agent and the file is not there. A failed
Agent job step may keep other steps from going forward. (Personally, I don't like being told that something FAILED when the situation (the file is not found) is perfectly acceptable.)
Maybe an addendum to the script would be to populate a Package Variable (maybe named User::FileExists) with "Yes" or "No" based on the results of the IF statement.
DotNet Global: Have you solved your original issue? Did you get the Script Task in SSIS to work?
Todd C - MSCTS SQL Server 2005 - Please mark posts as answered where appropriate.
Todd, i think we should evaluate everything under the code of business logic. That file could be waiting orders of retailers from a B2B portal which is going to be imported into ERP system or the warehouse system which is waiting for it to be committed to operate
or ship the goods. (see the file name: C:\inetpub\ftproot\INFILES\WEB-RETAILER.csv)
And if that file doesnt exists it could be a real problem. And within the for each loop you will not be able to determine if the file doesnt exist, cos nothing will happen in the loop if file doesnt exists. And if that doesnt exists i.e ETL process
must be blocked and Admin must be warned maybe by an email immediately and a high importance. We can not skip the part of "file doesnt exists". There could also be another actions taken based on the non-existance of the file.
But if it is a simple load and truncate issue, then you are right.
So it is better to ask Dot Net Global for the business logic.?