将 SQL server varchar max 存储在 SSIS 字符串中 [英] Store SQL server varchar max in SSIS string
问题描述
我在做什么 -
通过oledb连接
(OLE)从execute sql task
(EST)获取单行结果集.
Get single row result set from execute sql task
(EST) via oledb connection
(OLE).
我想设置 ssis 变量 strName = 行的第一列值(最大 varchar).strName 肯定是一个 ssis 字符串.我检查了.
I want to set ssis variable strName = row's 1st column value (a varchar max). strName is a ssis string FOR SURE. I checked.
在 EST - 结果名称 = 0,变量名称 = User::strName
.
In EST - result name = 0, variable name = User::strName
.
我收到错误 -
[执行 SQL 任务] 错误:给赋值时发生错误variable "strName": "分配给变量的值的类型"User::strName" 与当前变量类型不同.变量可能在执行期间不改变类型.变量类型是严格的,除了用于对象类型的变量.
[Execute SQL Task] Error: An error occurred while assigning a value to variable "strName": "The type of the value being assigned to variable "User::strName" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.
我该如何解决这个问题?
How do I fix this ?
推荐答案
问题是 SSIS 不理解 varchar(max) 作为数据类型.您需要指定限制.将 varchar(max) 列转换为 varchar(8000) 以解决问题.或者您可以将 VARCHAR 最大值存储到 SSIS 对象中,然后使用 object.ToString();
The problem is SSIS doesn't understand varchar(max) as a data type .You need to specify the limit . CAST the varchar(max) column to varchar(8000) to solve the problem. Or you can store the VARCHAR max into a SSIS object and then get the value using object.ToString();
这篇关于将 SQL server varchar max 存储在 SSIS 字符串中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!