Foreach File Enumerator on xml files (SSIS SQLserver 2008R2)

  • I have a data flow task in a for each container that loads xml files in a folder to database table.

    The issue that I am facing is when executed in the for loop, the variable that reads the filename is not

    getting the correct value and throwing an error. In the Variable Mappings tab in For Each container, I added a variable

    named strFile and used that variable in the expression for xmlfile name in the data flow task.

    It seems like the file name is not getting into variable. Please help me if you have gone through the same thing.

  • What is the error that you get?

    What value did you specify for the index in the variable mappings pane?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thanks for the response

    I am getting a validation error. I am trying to set the file name variable to xmldata property in the expressions.

    TITLE: Package Validation Error

    ------------------------------

    Package Validation Error

    ------------------------------

    ADDITIONAL INFORMATION:

    Error at Data Flow Task [EmpFile [2256]]: The value for custom property "XMLData" on component "EmpFile" (2256) is incorrect.

    Error at Data Flow Task [SSIS.Pipeline]: "component "EmpFile" (2256)" failed validation and returned validation status "VS_ISBROKEN".

    Error at Data Flow Task [SSIS.Pipeline]: One or more component failed validation.

    Error at Data Flow Task: There were errors during task validation.

    (Microsoft.DataTransformationServices.VsIntegration)

  • You can try to set a breakpoint at the dataflow, to see if the value of the variable matches your expectations.

    Another question: do the XML files always have the same structure? As SSIS is strongly typed about metadata, any metadata change can break your package.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • All the xml file has the same schema. As you said I tried to put a break point and it seems like I am not getting any value in strFile variable. is there anything wrong in what I am doing to retrieve the file? added a variable named strFile and used that variable for xmldata property.

  • I found the issue, in the xml source editor I didn't select the option "Xml file from variable" in the data access selection

    Thanks

  • santh.george (3/11/2011)


    I found the issue, in the xml source editor I didn't select the option "Xml file from variable" in the data access selection

    Thanks

    Just one of those days eh? 😀

    Time for the weekend!

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply