Error: ForEach Variable Mapping number 0 to variable "ᶈ珈" cannot be applied

  • Hi All,

    I am getting strange error mentioned below while executing my package.

    Error: ForEach Variable Mapping number 0 to variable "ᶈ珈" cannot be applied

    I am using SSIS 2012.

    I have an Execute SQL Task which is executing a query and result (only one column from a table) is stored in a object data type variable.

    Later I am using a for each loop container where I am using the same variable in collection.In variable mapping i have provided another variable with data type Int32 which is used in DFT inside for each loop container.

    But while executing I am getting above error.

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

  • rhythmk (4/6/2015)


    Hi All,

    I am getting strange error mentioned below while executing my package.

    Error: ForEach Variable Mapping number 0 to variable "??" cannot be applied

    I am using SSIS 2012.

    I have an Execute SQL Task which is executing a query and result (only one column from a table) is stored in a object data type variable.

    Later I am using a for each loop container where I am using the same variable in collection.In variable mapping i have provided another variable with data type Int32 which is used in DFT inside for each loop container.

    But while executing I am getting above error.

    Quick thought, this looks like an integer value being read as unicode, look into the object enumeration and check the column name etc..

    😎

    BTW is 51315 the value you were expecting?

  • Eirikur Eiriksson (4/6/2015)


    rhythmk (4/6/2015)


    Hi All,

    I am getting strange error mentioned below while executing my package.

    Error: ForEach Variable Mapping number 0 to variable "??" cannot be applied

    I am using SSIS 2012.

    I have an Execute SQL Task which is executing a query and result (only one column from a table) is stored in a object data type variable.

    Later I am using a for each loop container where I am using the same variable in collection.In variable mapping i have provided another variable with data type Int32 which is used in DFT inside for each loop container.

    But while executing I am getting above error.

    Quick thought, this looks like an integer value being read as unicode, look into the object enumeration and check the column name etc..

    😎

    BTW is 51315 the value you were expecting?

    what do you mean from object enumeration and where can i check that.

    No I am expecting integer values like 8,14 etc.

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

  • rhythmk (4/6/2015)


    Eirikur Eiriksson (4/6/2015)


    rhythmk (4/6/2015)


    Hi All,

    I am getting strange error mentioned below while executing my package.

    Error: ForEach Variable Mapping number 0 to variable "??" cannot be applied

    I am using SSIS 2012.

    I have an Execute SQL Task which is executing a query and result (only one column from a table) is stored in a object data type variable.

    Later I am using a for each loop container where I am using the same variable in collection.In variable mapping i have provided another variable with data type Int32 which is used in DFT inside for each loop container.

    But while executing I am getting above error.

    Quick thought, this looks like an integer value being read as unicode, look into the object enumeration and check the column name etc..

    😎

    BTW is 51315 the value you were expecting?

    what do you mean from object enumeration and where can i check that.

    No I am expecting integer values like 8,14 etc.

    Unfortunately I don't have SSDT available at the moment but it looks to me that the value you are getting there is either a pointer to an object variable or the full content, not the value of one row. Make certain that you are iterating/enumerating through the content of an object variable, not passing the object variable to an integer/numeric type variable.

    😎

  • convert the datatype in the Execute Sql Task to match enumerator type. See the below statement

    SELECT CAST(<columname> AS INT)

    FROM <talename>

  • I faced a similar issue and your solution worked...thanks!!!!

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

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