I am using Execute Process task in SSIS 2008 R2. I have a variable idVar which is of data type Int32. I need to pass this variable to property Arguments of the task so the process executable can take this variable as argument. I use expression to assign @idVar to Arguments.
Now the system says I need to convert Int to String so I used the following expression in the expression builder
(DT_STR, 10, 1252) @[User::IdVar]
It gives the following error:
Expression cannot be evaluated.
Additional information:
The expression "(DT_STR, 10, 1252) @[User:IdVar]" has a result type of "DT_STR",
which cannot be converted to a supported type.
(Microsoft.DataTransformationServices.Controls)
What is the correct way to type cast the number to string?

Cause of the issue:
Argumentsproperty in Execute Process Task available on the Control Flow tab is expecting a value of data typeDT_WSTRand notDT_STR.SSIS 2008 R2 package illustrating the issue and fix:
Create an SSIS package in Business Intelligence Development Studio (BIDS) 2008 R2 and name it as
SO_13177007.dtsx. Create a package variable with the following information.Drag and drop an Execute Process Task onto the Control Flow tab and name it as Pass arguments
Double-click the Execute Process Task to open the
Execute Process Task Editor. Click Expressions page and then click the Ellipsis button against the Expressions property to view theProperty Expression Editor.On the Property Expression Editor, select the property
Argumentsand click the Ellipsis button against the property to open theExpression Builder.On the Expression Builder, enter the following expression and click
Evaluate Expression. This expression tries to convert the integer value in the variableIdVarto string data type.Clicking Evaluate Expression will display the following error message because the Arguments property on Execute Process Task expects a value of data type
DT_WSTR.To fix the issue, update the expression as shown below to convert the integer value to data type
DT_WSTR. Clicking Evaluate Expression will display the value in the Evaluated value text area.References:
To understand the differences between the data types
DT_STRandDT_WSTRin SSIS, read the documentation Integration Services Data Types on MSDN. Here are the quotes from the documentation about these two string data types.DT_STR
A null-terminated ANSI/MBCS character string with a maximum length of 8000 characters. (If a column value contains additional null terminators, the string will be truncated at the occurrence of the first null.)
DT_WSTR
A null-terminated Unicode character string with a maximum length of 4000 characters. (If a column value contains additional null terminators, the string will be truncated at the occurrence of the first null.)