How can i use Parameter Mapping in Execute SQL Task in SSIS?

sql-server-2008, ssis

Solution

This message occurs when the default datatype for the parameters remains as 'LONG' instead of whatever is necessary... In your case, this should be 'BYTE'

Problem

I am trying to retrieve the value of `Key` from a table with a simple select statement in SSIS through `Execute SQL Task`. But have no luck figuring out this error. I have used one input variable with string data type and used this variable in parameter mapping in `Execute SQL Task`. Executing the query "SELECT cast([Key] as Int) FROM Table where column = ?" failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_I4)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. Note : Datatype for `Key` column is `tinyint`

Original source