SSIS Execute SQL Task With VARCHAR(MAX)
While I was using the SSIS Execute SQL Task to return a single row result I getting the following error:
[Execute SQL Task] Error: An error occurred while assigning a value to variable "RestoreCmd": "The type of the value being assigned to variable "User::RestoreCmd" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object!."
This was happening becuase I was trying to assgin a varchar(max) result column to SSIS string variable.
There are two ways to solve this problem; one is to change the SSIS variable to object and convert each time it used to a string; the second way to solve this is to cast result column to max size limit.
[Execute SQL Task] Error: An error occurred while assigning a value to variable "RestoreCmd": "The type of the value being assigned to variable "User::RestoreCmd" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object!."
This was happening becuase I was trying to assgin a varchar(max) result column to SSIS string variable.
There are two ways to solve this problem; one is to change the SSIS variable to object and convert each time it used to a string; the second way to solve this is to cast result column to max size limit.
Comments