Error: The type of the value (DBNull) being assigned to variable "User:: differs from the current variable type (String)

Viewed 27293

I am creating a SSIS package and getting the following error while extracting the data.

Error: The type of the value (DBNull) being assigned to variable "User::dunsId" differs from the current variable type (String). Variables may not change type during execution. Variable types are strict, except for variables of type Object.

dunsId is varchar(150) in the source table which is nullable column and contains Null value. The variable that I have created in SSIS to map it is of type string. I am basically trying to extract all he records and insert it in the destination table that contains column dunsId is varchar(150)

here is my insert query

INSERT INTO Parties (companyId, dunsId, companyName, companyTypeId,companyTypeName,companyStatusTypeId,companyStatusTypeName,simpleIndustryId,simpleIndustryDescription)  
values (companyId, dunsId, companyName, companyTypeId, companyTypeName,companyStatusTypeId,companyStatusTypeName,simpleIndustryId,simpleIndustryDescription)

Parameter mapping enter image description here

variables

enter image description here

design

enter image description here

2 Answers

The Variable type for dunsId variable is STRING & you trying to assign a value for this variable NULL at runtime i.e your query returns NULL for column dunsId which is not supported for variable type String please declare it as type Object.

enter image description here

Related