How to get all errors of all SSIS packages in a solution(如何获取解决方案中所有 SSIS 包的所有错误)
问题描述
在 Visual Studio 2015 中,我在 SSIS 包文件夹中有一个包含 3 个 dtsx 的解决方案.我重新构建解决方案并获得成功.只有当我一个接一个地打开一个 dtsx 时,我才注意到其中一些(不是全部)实际上有几个问题.
In Visual Studio 2015 I have a solution with 3 dozens dtsx in the SSIS Packages Folder. I re-build the solution and I get success. Only when I open single dtsx one after the other I notice that some of them (not all), actually, have several problems.
有没有办法在错误列表中获取这些问题的列表,还是需要一个一个打开所有dtsx?
Is there a way to get a list of these problems in the Error List or do I need to open all dtsx one by one?
推荐答案
不幸的是,如果不打开包或使用 DTExec Utility 执行它们,就无法从集成服务解决方案(在 Visual Studio 中)实现这一点代码>.但是您可以采取一些解决方法并以编程方式检查获取错误:
Unfortunately, there is no way to achieve this from your integration services solution (in visual studio) without opening the packages or maybe executing them using DTExec Utility. But you can do some workaround and check get errors programmatically:
解决方法
- 我使用 Visual Studio(使用 Vb.Net)创建了一个 winforms 应用程序
- 我添加了
Microsoft.SqlServer.DTSPipelineWrap和Microsoft.SQLServer.ManagedDTS作为参考 我使用以下代码遍历特定目录中的包、验证并将错误写入日志文件:
- I created a winforms application using visual studio (using Vb.Net)
- I added
Microsoft.SqlServer.DTSPipelineWrapandMicrosoft.SQLServer.ManagedDTSas references I used the following code to loop over packages in a specific directory, validate, and get errors into a log file:
Dim strPackagesDirectory As String = "C:UsersAdminDesktopNew folder"
Dim strOutputLogFile As String = "D:1.txt"
For Each strFile As String In IO.Directory.GetFiles(strPackagesDirectory, "*.dtsx", IO.SearchOption.TopDirectoryOnly)
Dim pckg As New Microsoft.SqlServer.Dts.Runtime.Package
Dim app As New Microsoft.SqlServer.Dts.Runtime.Application
pckg = app.LoadPackage(strFile, Nothing)
Dim obj = pckg.Validate(Nothing, Nothing, Nothing, Nothing)
If pckg.Errors.Count > 0 Then
Using sr As New IO.StreamWriter(strOutputLogFile, True)
sr.WriteLine("")
sr.WriteLine(strFile)
sr.WriteLine("--------------")
For Each err As Object In pckg.Errors
sr.WriteLine(err.Description)
Next
sr.WriteLine("==========")
sr.Close()
End Using
End If
Next
参考资料
- https://msdn.microsoft.com/en-us/library/ms136090.aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1莉>
- https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.package.aspx
- https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.dtscontainer.validate.aspx
这篇关于如何获取解决方案中所有 SSIS 包的所有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何获取解决方案中所有 SSIS 包的所有错误
基础教程推荐
- 在多列上分布任意行 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
