[英]Execute SQL Task fails in SSIS 2008 package but runs successfully outside package
I created an execute sql task to save the filenames encountered in a Foreach Loop task into a database table, this works fine when I run the the individual task and it writes the filename to the database table (see below) UNABLE TO POST IMAGES CURRENTLY ![task successfully runs][1] However when i run the complete SSIS package, this task fails (see below) UNABLE TO POST IMAGES CURRENTLY 我创建了一个执行sql任务,以将在Foreach Loop任务中遇到的文件名保存到数据库表中,当我运行单个任务并将文件名写到数据库表中时,此方法工作正常(请参见下文)无法当前发布图像! [任务成功运行] [1]但是,当我运行完整的SSIS程序包时,此任务失败(请参阅下文),无法当前发布图像
![unsuccessful execution][2] The error message I am getting is: ![执行不成功] [2]我收到的错误消息是:
Error: String or binary data would be truncated.
[Execute SQL Task] Error: Executing the query "insert into filename_staging_table
(FileName) Val..." failed with the following error:
"The statement has been terminated.". Possible
failure reasons: Problems with the query,
"ResultSet" property not set correctly, parameters
not set correctly,
or connection not established correctly.
Any guidance with this greatly appreciated....I am completely stuck!!!! 任何对此的指导非常感谢....我完全被卡住了!!!!
Thanks 谢谢
The error reads "String or binary data would be truncated." 错误显示为“字符串或二进制数据将被截断”。 The reason the script works when run manualy is because you are only trying to insert one value. 手动运行时脚本起作用的原因是,您仅尝试插入一个值。 That value is within the length constraint of your column. 该值在列的长度限制内。
When you run the task, it is looping through a list of filenames and trying to insert each one. 当您运行任务时,它会遍历文件名列表并尝试插入每个文件名。 One of these names is too long for the field you are trying to insert it into. 这些名称之一对于您要插入的字段太长。
You need to change the length of the field in SQL or you need to use a LEFT(filename, xx) on the filename itself so that a only the first xx characters are inserted into your table. 您需要在SQL中更改字段的长度,或者需要在文件名本身上使用LEFT(filename,xx),以便仅前xx个字符插入到表中。 (Change the xx to the number of characters to be inserted) (将xx更改为要插入的字符数)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.