Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs

SSIS Foreach NodeList Enumerator

by suresh

The SSIS Foreach NodeList Enumerator is useful to enumerate the XML nodes. For example, you can traverse to any node in an XML file using this enumerator. In this article, we will show you how to use this SSIS Foreach NodeList Enumerator with an example.

Before we start demonstrating the Foreach NodeList Enumerator in SSIS, Let me show you the data that we are going to use for this example. It is Employee Table present in SQL Server that we are going to use for this example:

Execute SQL Task in SSIS Full Row Set 1

Below query will convert the data in Employee table to an XML file

SSIS Foreach NodeList Enumerator 1

and the data inside the XML file is:

SSIS Foreach NodeList Enumerator 2

SSIS Foreach NodeList Enumerator Example

In this SSIS Foreach NodeList Enumerator example, we will enumerate the nodes in the above XML file, and copy the Occupation column information into another database table. To do so, First Drag and drop the Foreach Loop Container into the Control Flow region

SSIS Foreach NodeList Enumerator 3

Double click on it will open the Foreach Loop Editor to configure it. Within the SSIS General tab, Please specify valid Name and Description. Here, we assigned the name as SSIS Foreach NodeList Enumerator

SSIS Foreach NodeList Enumerator 4

Next, go to the Collections tab to select the Enumerator. Here, we are choosing Foreach NodeList Enumerator because we want to loop over the XML nodes.

SSIS Foreach NodeList Enumerator 5

The following is the list of properties that you have to configure for this SSIS Foreach NodeList Enumerator.

SSIS Foreach NodeList Enumerator 6

Document Source Type: This SSIS Foreach NodeList Enumerator property has three options:

  • File Connection: It means, the source is in an XML file present in the file system. You can use the next property to select the file.
  • Variables: Source is present in the variable. If you select this option, then you have to select the variable name in the next option.
  • Direct Input: We want to insert the XML data directly into this editor. For now, we are selecting this option.
SSIS Foreach NodeList Enumerator 7

As you can see, we inserted the above-specified XML data

SSIS Foreach NodeList Enumerator 8

Enumerator Type: This Foreach NodeList Enumerator property has four options:

  • Navigator: This will enumerate using XpathNavigator
  • Node: Enumerate nodes.
  • NodeText: This will enumerate text nodes. It is useful to narrow down your search.
  • ElementCollection: IT enumerate element nodes returned by the Xpath.
SSIS Foreach NodeList Enumerator 9

Next, we are providing the path. Below path will navigate to Occupation node present in each Employ under the Employee details node.

SSIS Foreach NodeList Enumerator 10

Now select the existing variable and assign it to index 0. Once completed, Click OK to finish configuring the Foreach Loop Container.

SSIS Foreach NodeList Enumerator 11

Next, Drag and drop the Execute SQL Task to Foreach loop container. This task helps us to insert the values into our Empty table.

SSIS Foreach NodeList Enumerator 12

Double click on it will open the Execute SQL Task Editor window. Here, we selected the OLE DB Connection type and chose the existing connection, which is pointing to [SQL Tutorials] Database.

SSIS Foreach NodeList Enumerator 13

Next, we are writing the following SQL Query to insert the table name into the SMO_Enumerator table.

INSERT INTO [NodeListEnumerator] ([Occupation])
                          VALUES (?)

Here question mark will be replaced by the parameter.

SSIS Foreach NodeList Enumerator 14

Please cross-check all the properties before you start parameter mapping

SSIS Foreach NodeList Enumerator 15

Next, go to parameter mapping and select the parameter that we assigned in the Foreach Loop container. It means the Foreach loop container will loop through the XML nodes, and store the occupation information in the variable. Next, we are passing that variable into Execute SQL task

SSIS Foreach NodeList Enumerator 16

Click OK to finish configuring the SSIS Foreach NodeList Enumerator package. Let us Run the package

SSIS Foreach NodeList Enumerator 17

Let us open the SQL Server management studio and check whether we inserted the Occupation details into the destination table using SSIS Foreach NodeList Enumerator or not

SSIS Foreach NodeList Enumerator 18

Placed Under: SSIS

  • What is SSIS
  • Install SQL Server Data Tools
  • Learn SSIS in 28 Days
  • Create a SSIS Project
  • Create SSIS Package
  • SSIS Connection Manager
  • OLE DB Connection Manager
  • SSIS ADO Connection Manager
  • ADO.NET Connection Manager
  • SSIS Cache Connection Manager
  • SSIS Excel Connection Manager
  • SSIS File Connection Manager
  • SSIS FTP Connection Manager
  • SSIS SMO Connection Manager
  • Source Assistance in SSIS
  • Flat File Source in SSIS
  • OLE DB Source in SSIS
  • Excel Source in SSIS
  • ADO.NET Source in SSIS
  • SSIS FLAT FILE Destination
  • SSIS OLE DB Destination
  • SSIS ADO.NET Destination
  • SSIS Transformations
  • SSIS Audit Transformation
  • SSIS Aggregate Transformation
  • SSIS Aggregate Advanced Mode
  • SSIS Cache Transformation
  • SSIS Character Map
  • SSIS Conditional Split
  • SSIS Copy Column
  • SSIS Data Conversion
  • SSIS Derived Column
  • SSIS Export Column
  • SSIS Fuzzy Grouping
  • SSIS Fuzzy Lookup
  • SSIS Import Column
  • SSIS Lookup Introduction
  • Lookup – OLE DB Connection
  • SSIS Lookup in Full Cache Mode
  • SSIS Lookup – Case Sensitivity
  • SSIS Merge Transformation
  • SSIS Merge Join Transformation
  • SSIS Merge Join – Left Outer Join
  • SSIS Merge – Right Outer Join
  • SSIS Merge Join – Full Outer Join
  • SSIS Multicast Transformation
  • SSIS OLEDB Command
  • OLEDB Command – Delete Data
  • OLEDB Command-Update Data
  • SSIS Percentage Sampling
  • SSIS Pivot Transformation 2008
  • SSIS Pivot Transformation
  • SSIS Row Count Transformation
  • SSIS Row Sampling
  • Script Component as Source
  • Script Component as Destination
  • SSIS Script as Transformation
  • SSIS Sort Transformation
  • SSIS SCD Type 0
  • SSIS SCD Type 1
  • SSIS SCD Type 2
  • SSIS Term Lookup
  • SSIS Term Extraction Intro
  • Term Extraction – Extract Nouns
  • SSIS Extract Noun Phrases
  • Extract Nouns & Noun Phrases
  • Term Extraction – Exclusion Tab
  • SSIS Unpivot Transformation
  • SSIS Union All Transformation
  • SSIS For Loop Container
  • SSIS ForEach File Enumerator
  • SSIS ForEach SMO Enumerator
  • SSIS ForEach Variable
  • SSIS Foreach NodeList
  • Foreach ADO.NET Schema Rowset Enumerator
  • SSIS Bulk Insert Task
  • SSIS Data Profiling Task
  • Execute T-SQL Statement Task
  • SSIS Execute SQL Task Intro
  • SSIS Execute SQL Task Example
  • Execute SQL Task- Single Rowset
  • Execute SQL Task – Full Row Set
  • SSIS Execute Package Task
  • Execute Packages in SQL Server
  • Execute Packages in File System
  • SSIS Execute Package Project Reference
  • SSIS File System Task
  • SSIS File System Task- Copy Files
  • File System Task-Copy Directory
  • File System Task – Delete Files
  • File System Task – Delete Folder
  • File System Task -Move Directory
  • SSIS File System Task -Move File
  • File System – Move Multiple files
  • File System Task – Rename File
  • File System Task – Set Attributes
  • SSIS FTP TASK
  • SSIS Create Local Directory
  • SSIS Create Remote Directory
  • SSIS FTP Task Send Files
  • SSIS FTP – Send Multiple Files
  • SSIS FTP Task Delete Local Files
  • FTP TASK Delete Local Directory
  • FTP Task Delete Remote files
  • SSIS Delete Remote Directory
  • SSIS FTP Task Receive Files
  • SSIS FTP Receive Multiple Files
  • SSIS Script Task
  • Transfer SQL Server Objects Task
  • Transfer SQL Table Structures
  • Transfer SQL Tables with Data
  • Transfer SQL Stored Procedures
  • Transfer User Defined Functions
  • Transfer SQL Views in SSIS
  • SSIS Web Service Task
  • SSIS XML Task-Validate XML File
  • Transform XML File using XSLT
  • XML Task-XML files Differences
  • Create SSIS Catalog
  • Package Deployment using BIDS
  • Deploy Package Using SQL
  • Deploy using SQL Server Wizard
  • SSIS Breakpoints
  • SSIS Checkpoints
  • SSIS Error Handling
  • SSIS Event Handlers
  • SSIS Transactions
  • SSIS Logging
  • SSIS Parameters
  • SSIS Package Configuration
  • Configure using SQL Server
  • Config using Registry Entry
  • Conf with Environment Variable
  • SSIS XML Configuration File
  • XML Configuration File Part 2
  • SSIS Package Protection Level
  • SSIS Incremental Load
  • Incremental Load Example 2
  • SSIS Remove Double Quotes

Copyright © 2021· All Rights Reserved.
About | Contact | Privacy Policy