March 30, 2012 at 4:05 am
Hi,
Does anyone know why the foreach loop in ssis 2005 does not error out if the directory path specfied is invalid?
Is there any way I can do this? If the directory path is invalid it just gives me a warning message saying there are no files to loop through or the directory is empty.
I know I can probably write a script task before the foreach loop to achieve this but I just want to know if the foreach loop has a property that I can set to achieve this.
The magic and wonders of SSIS do not let me believe that there is no such property or a simple way of doing this 🙂
Thanks...
March 30, 2012 at 7:03 am
The reason there's no error is probably because the For Each Loop thinks it has no access rights, so there are no files to loop over.
So I would check it in a script task 🙂
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
March 30, 2012 at 7:10 am
Koen Verbeeck (3/30/2012)
The reason there's no error is probably because the For Each Loop thinks it has no access rights, so there are no files to loop over.So I would check it in a script task 🙂
My thoughts about this are that the FOREACH task has been deliberately engineered to be forgiving - it never generates errors if it does not find what it is looking for - which I think is what most people want.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
March 30, 2012 at 7:17 am
Thank you both for your answers, I would understand if it doesnot error out when it does not find anything under the specified directory. But I find it a bit strange that id does not complain even when the directory path is completely invalid! Anyways, I'll go back to using my script task then .... 🙂
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply