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 包的所有错误
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- SQL 临时表问题 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
