SSIS包在部署SQL Server 2012之后给出错误 [英] SSIS package gives error after deployment 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之后给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!