SSIS ForEach Loop Error : ForEach Variable Mapping number n to variable "%s" cannot be applied.

When we are trying to select  different columns which includes bigint column also and insert that result into SSIS Object datatype variable  Using Execute SQL task . In the next Step when we are using that same Object varible  in ForEachLoop then we are facing this Error .

Error: The type of the value being assigned to variable "User::MaxEpoch" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.
Why this error is coming :  In ForEachloop the Bigint value from the Object Variable is mapped to Int64 datatype variable in SSIS . Here the problem is occuring that convertion is not possible in ForEach Loop when dealing with Object variable as enumerator . When we are trying to insert BigInt column value directly into Int64 variable using ExcuteSQL task is working fine .The problem is with ForEachloop only .

Work around :  we are converting that BigInt Column into Varchar before inserting into the Object variable and later In For each loop we are Mapping that column to String datatype variable .

Comments

Popular posts from this blog

SSAS : A connection cannot be made to redirector. Ensure that 'SQL Browser' service is running. (Microsoft.AnalysisServices.AdomdClient). + Solution

SSIS Error : Unable to infer the XSD from the XML file. The XML contains multiple namespaces