SSIS package gives error after deployment SQL Server 2012(SSIS 包在部署 SQL Server 2012 后出错)
问题描述
我在 Visual Studio 2015 中创建了一个包.它运行良好.
I created a package in Visual Studio 2015. It works fine.
基本上我正在使用一个脚本任务来生成 Excel 电子表格并将其发送给不同的用户.
Basically I am using a script task that generates Excel spreadsheet and sends it to different users.
在我将包部署到 SQL Server 2012 并尝试从那里执行之后 - 我收到一个没有任何进一步细节的错误.
After I deploy the package to SQL Server 2012 and then try to execute it from there - I get an error without any further details.
我还从 SSISDB 运行 select * from internal.packages
以确保 package_format_version
为 6,这应该是 SQL Server 2012 的值.
I also run select * from internal.packages
from SSISDB to make sure package_format_version
is 6, which is what should be for SQL Server 2012.
可能是什么问题?
推荐答案
这不一定是关于如何解决问题的答案,而是关于如何修改脚本任务以获得更好的错误消息的答案脚本任务失败:已抛出异常..."
This necessarily isn't an answer on how to fix the issue, but it's an answer on how you can modify your script task to get a better error message then "Script Task Failure: Exception has been thrown..."
我们总是将我们的脚本任务包装在一个 try-catch 中,然后将异常消息从脚本任务中抛出:
We'll always wrap our script tasks in a try-catch and then raise the exception message back out of the script task:
public void Main()
{
try
{
//Your code here
Dts.TaskResult = (int)ScriptResults.Success;
}
catch (Exception ex)
{
Dts.Events.FireError(-1, "", ex.Message, String.Empty, 0);
Dts.TaskResult = (int)ScriptResults.Failure;
}
}
这始终是一个挑战,尤其是对于已部署的 SSIS 包,当它在脚本任务上出错时,您不一定能清楚地了解它失败的原因,并且您会收到一条神秘的错误消息.上面的代码将捕获抛出异常的内容并将其返回给集成服务.
It's always a challenge, especially with a deployed SSIS package, when it errors on a scrip task you don't necessarily get a clear indication as to why it's failing and you get a cryptic error message. The above code will capture what threw the exception and bubble back out to integration services what that was.
这篇关于SSIS 包在部署 SQL Server 2012 后出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SSIS 包在部署 SQL Server 2012 后出错


基础教程推荐
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01