0% found this document useful (0 votes)
56 views1 page

1

The document outlines steps to process files in a folder using a Foreach File Enumerator task in SQL Server Integration Services: 1) Create a variable to store the file path, 2) Add a Foreach File Enumerator task and configure it to enumerate files in a source folder, 3) Map the file path variable, 4) Add Execute SQL and File System tasks inside the enumerator, and 5) Apply a precedence constraint to only run the tasks when the file extension is CSV or DOCX.

Uploaded by

mail.akumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views1 page

1

The document outlines steps to process files in a folder using a Foreach File Enumerator task in SQL Server Integration Services: 1) Create a variable to store the file path, 2) Add a Foreach File Enumerator task and configure it to enumerate files in a source folder, 3) Map the file path variable, 4) Add Execute SQL and File System tasks inside the enumerator, and 5) Apply a precedence constraint to only run the tasks when the file extension is CSV or DOCX.

Uploaded by

mail.akumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

Create a new variable FullPath of string data type to hold file name.

2. Drag a new “Foreach File Enumerator“task in BIDS.

3. Click on “Foreach File Enumerator” and go to Collection tab and browse your source
folder and leave *.* for files

4. Go to Variable Mappings tab now and map variable FullPath


 
5. Point your folder path under collection tab.

6. Assign FullPath variable mappings tab.


 
7. Drag one “Execute SQL Task” and “File System task” inside “ForeachFile
Enumerator“container.

8. First execute SQL task is just dummy so that we can apply Precedence constraint

9. After connecting both execute SQL task, apply Precedence constraint


 
UPPER(SUBSTRING(@[FullPath],FINDSTRING(@[FullPath],".",1)+1,LEN(@[FullPath])))=="CSV"||
UPPER(SUBSTRING(@[FullPath],FINDSTRING(@[FullPath],".",1)+1,LEN(@[FullPath])))=="DOCX"

Above can be modified to include more or different file types

You might also like