Quantcast
Channel: SQL Server
Viewing all articles
Browse latest Browse all 3819

Blog Post: SSIS For Loop Skip Files

$
0
0
When running a For Each Loop through a set of files, sometimes you will have specific files that you do not want to load. For example, I have a set of files named: Abc.txt Mno.txt Rts.txt Wln.txt Xyz.txt If I want to skip the file that starts with “W” then I will need an expression in my For Each Loop to detect this file. Inside the For Each loop I am going to place a sequence container. This will give me a place to anchor my expression which I will place on the precedence constraint coming from the sequence container. There are no tasks in the sequence container. On the precedence constraint line I am going to set it to constraint and expression. The expression will be: substring(Upper(@strFileName),1,1) != “W” This is looking at the first letter in the filename and comparing it to the letter “W”. I would place the “W” in a variable and use that instead, I am just showing this way for simplicity. Notice I convert the file name variable to upper case and compare it to an uppercase “W”. That way the case will not matter.

Viewing all articles
Browse latest Browse all 3819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>