如何在 SSIS 的执行 SQL 任务中使用参数映射? [英] How can i use Parameter Mapping in Execute SQL Task in SSIS?
问题描述
我试图通过 Execute SQL Task
在 SSIS 中使用简单的 select 语句从表中检索 Key
的值.但是没有运气找出这个错误.
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.
我使用了一个字符串数据类型的输入变量,并在执行 SQL 任务
的参数映射中使用了这个变量.
I have used one input variable with string data type and used this variable in parameter mapping in Execute SQL Task
.
执行查询SELECT cast([Key] as Int) FROM Table wherecolumn = ?" 失败并出现以下错误:发生错误将结果提取到类型为 (DBTYPE_I4)" 的变量中.可能失败原因:查询有问题,未设置ResultSet"属性正确,参数设置不正确,或未建立连接正确.
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.
注意:Key
列的数据类型是 tinyint
Note : Datatype for Key
column is tinyint
推荐答案
当参数的默认数据类型保持为LONG"而不是任何必要的数据类型时,会出现此消息...在您的情况下,这应该是BYTE"
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'
这篇关于如何在 SSIS 的执行 SQL 任务中使用参数映射?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!