Error: ForEach Variable Mapping number 1 to variable "User::bye" cannot be applied when Loading Xml files Into Sqlserver 2014 Database by using Foreach loop container(SSIS)

  • Dear all,

    I'm trying to load the xml files into ssis 2014 database by using foreach loop container.

    Below are the steps am following to load,and xml files are coming as one of column from source table with xml datatype.

    1) Converting the xml column datatype into nvarchar(max) and created a veriable in Object datatype(in execute sqltask)

    2)Passing the Object veriable into Foreach loop container( by using ADO enumarator) and created a string datatype veriable to hold the Object datatype data (which is having xml data)

    Now trying to run the foreach container but getting below error.

    Error: ForEach Variable Mapping number 1 to variable "User::bye" cannot be applied.

    Error: ForEach Variable Mapping number 1393214138 to variable "稨掸" cannot be applied.

    Can anyone help on this error who got experienced on these type of error.

    Regards,

    Saikumar K.

  • Hi

    I'm afraid the problem is occurring that conversion is not possible in ForEach Loop when dealing with object variable as enumerator. Please try to convert before inserting into the object variable.

    Br.

    Mike

  • Hi Mike,

    I'm able to process most of the xml file with't any issues but facing error with few of the xml files.

    As I said ,I'm converting the datatype in execute sql task and storing with Object datatype by using veriable.

    After that I'm calling that veriable in foreach loop container for looping purpose ,here am storing the object datatype veriable values into String datatype veriable.

    With above am able to process most of the xml files with't any headache but few of files are giving this kind of error.

    Regards,

    Saikumar K.

  • Please tell me what element you have inside the Foreach Loop Container?

    Try to cast to nvarchar(4000) in SQLStatement of Execute SQL Task instead of max (SSIS doesn't love it).

    Best regards

    Mike

  • Hi Mike,

    Please find the attached screenshot of my workflows,which may give you clear information.

    As you said,i can not take the nvarchar(4000) because we are getting large source files ,hence am using max .

    Regards,

    Saikumar K

  • Hi Saikumar

    Please try out my package (connection string change required),

    it's from SQL 2012 but should work fine.

    Br.

    Mike

Viewing 6 posts - 1 through 5 (of 5 total)

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