简体   繁体   English

在SSIS 2008程序包中执行SQL任务失败,但在程序包外成功运行

[英]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.

相关问题 SSIS package 在由 sql 作业代理运行时失败 - SSIS package fails when runs by sql job agent 在SSIS包中的执行SQL任务中使用链接服务器 - Use Linked Server in Execute SQL Task within SSIS Package SSIS包-通过不同的连接循环执行Execute SQL任务 - SSIS package - loop through different connections for Execute SQL task 手动完成后,批处理文件将成功执行SSIS包,但使用Windows Task Scheduler执行该批处理文件时将失败 - Batch file executes SSIS package successfully when done manually, but fails when it's executed with Windows Task Scheduler SSIS执行包任务 - 在子包上失败时重试 - SSIS execute package task - retry on failure on child package SSIS包DataFlowTask for Excel导入到SQL Server 2014在我的本地实例上运行,但在服务器上部署失败时 - SSIS package DataFlowTask for Excel Import to SQL Server 2014 runs on my local instance, but when deployed fails on the server SSIS Package 在 VS2019 中运行良好,但在 SQL 2019 上的 SSISDB 中部署时立即失败 - SSIS Package runs fine in VS2019 but it fails immediately when it is deployed in SSISDB on SQL 2019 使用SSIS包执行SQL Server作业 - execute a SQL Server Job using SSIS package SSIS 包每两周运行一次,但如果失败则没有反向计划 - SSIS package which runs biweekly but there is no reverse out plan if it fails 如何将执行SQL任务的输出写入平面文件SSIS 2008 - how to write the output of an execute SQL task in to a flat file SSIS 2008
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM