我正在创建一个框架,用于从 MVC 应用程序启动和监视 SSIS 包。我的大部分工作都在工作,我正试图改进我的监视器功能,以便我可以在浏览器中显示包的表示。我已经能够创建一个能够唯一标识包的所有“源”组件的查询,但这只是一个平面表示,不允许我识别序列及其相关步骤。
我想做的是创建 SSIS 日志表的分层查询,它将提供如下表示:
Package Start
Step 1
Sequence A
Step A1
Step A2
Sequence B
Step B1
Step B2
Step 2
Sequence C
Step C1
Step C2
Step C3
Step 4
Step 5
Package End
通过能够创建层次结构,我希望能够在浏览器中创建包的表示,并且与目前不同的是,只能在平面表中显示它,我应该能够将序列步骤放在里面一个序列,并为用户提供有关流程所在位置的更好反馈。
我将用于定义包的日志条目示例(我将使用以前运行的实例中的条目来获取定义)如下所示:
id event computer operator source sourceid executionid starttime endtime datacode databytes message
2478 PackageStart {MACHINE} {USER} Package 3BC68A08-3B6E-4138-BC79-4B124A37FF60 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:56:58.000 2013-06-18 17:56:58.000 0 0x Beginning of package execution.
2479 OnPreExecute {MACHINE} {USER} Package 3BC68A08-3B6E-4138-BC79-4B124A37FF60 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:56:58.000 2013-06-18 17:56:58.000 0 0x
2480 OnPreExecute {MACHINE} {USER} Receive Orders 96FEEE13-2053-4B6F-9EF6-13F063CBED0B 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:56:59.000 2013-06-18 17:56:59.000 0 0x
2481 OnProgress {MACHINE} {USER} Receive Orders 96FEEE13-2053-4B6F-9EF6-13F063CBED0B 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:06.000 2013-06-18 17:57:06.000 100 0x Executing query "DECLARE @RowCount INT SET @RowCount = 0 WHILE @Ro...".
2482 OnPostExecute {MACHINE} {USER} Receive Orders 96FEEE13-2053-4B6F-9EF6-13F063CBED0B 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:06.000 2013-06-18 17:57:06.000 0 0x
2483 OnPreExecute {MACHINE} {USER} Update Status to Processing 4EE144BF-CA76-4BA5-B0B2-77E0899A22C0 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:06.000 2013-06-18 17:57:06.000 0 0x
2484 OnProgress {MACHINE} {USER} Update Status to Processing 4EE144BF-CA76-4BA5-B0B2-77E0899A22C0 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:06.000 2013-06-18 17:57:06.000 100 0x Executing query "UPDATE [dbo].[Order] SET [Status] = 2 WHERE ...".
2485 OnPostExecute {MACHINE} {USER} Update Status to Processing 4EE144BF-CA76-4BA5-B0B2-77E0899A22C0 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:06.000 2013-06-18 17:57:06.000 0 0x
2486 OnPreExecute {MACHINE} {USER} Clear dates before processing orders BE85B6A1-07D0-41E6-B76D-9554348867A9 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:06.000 2013-06-18 17:57:06.000 0 0x
2487 OnProgress {MACHINE} {USER} Clear dates before processing orders BE85B6A1-07D0-41E6-B76D-9554348867A9 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:10.000 2013-06-18 17:57:10.000 100 0x Executing query "UPDATE [dbo].[Order] SET [ProcessedDate] = NU...".
2488 OnPostExecute {MACHINE} {USER} Clear dates before processing orders BE85B6A1-07D0-41E6-B76D-9554348867A9 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:10.000 2013-06-18 17:57:10.000 0 0x
2489 OnPreExecute {MACHINE} {USER} Process Sequencer 4535503D-3DED-4D12-BE07-431A285A29F3 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:10.000 2013-06-18 17:57:10.000 0 0x
2490 OnPreExecute {MACHINE} {USER} Set Processed Date C027DF69-3006-4BB7-8F04-CD04DACF6910 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:10.000 2013-06-18 17:57:10.000 0 0x
2491 OnProgress {MACHINE} {USER} Set Processed Date C027DF69-3006-4BB7-8F04-CD04DACF6910 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:15.000 2013-06-18 17:57:15.000 100 0x Executing query "UPDATE [dbo].[Order] SET [ProcessedDate] = GET...".
2492 OnPostExecute {MACHINE} {USER} Set Processed Date C027DF69-3006-4BB7-8F04-CD04DACF6910 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:15.000 2013-06-18 17:57:15.000 0 0x
2493 OnPreExecute {MACHINE} {USER} Create Pick List 680E0119-20A1-43A7-87F9-F4A0ECB292D0 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:15.000 2013-06-18 17:57:15.000 0 0x
2494 OnProgress {MACHINE} {USER} Create Pick List 680E0119-20A1-43A7-87F9-F4A0ECB292D0 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:28.000 2013-06-18 17:57:28.000 100 0x Executing query "INSERT [dbo].[PickList] ([OrderID] ,[Picke...".
2495 OnPostExecute {MACHINE} {USER} Create Pick List 680E0119-20A1-43A7-87F9-F4A0ECB292D0 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:28.000 2013-06-18 17:57:28.000 0 0x
2496 OnPostExecute {MACHINE} {USER} Process Sequencer 4535503D-3DED-4D12-BE07-431A285A29F3 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:28.000 2013-06-18 17:57:28.000 0 0x
2497 OnPreExecute {MACHINE} {USER} Update Shipping Date 2C9E46A4-FDCE-425B-AC46-666B783CFD44 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:28.000 2013-06-18 17:57:28.000 0 0x
2498 OnProgress {MACHINE} {USER} Update Shipping Date 2C9E46A4-FDCE-425B-AC46-666B783CFD44 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:32.000 2013-06-18 17:57:32.000 100 0x Executing query "UPDATE [dbo].[Order] SET [ShippedDate] = GETUT...".
2499 OnPostExecute {MACHINE} {USER} Update Shipping Date 2C9E46A4-FDCE-425B-AC46-666B783CFD44 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:32.000 2013-06-18 17:57:32.000 0 0x
2500 OnPostExecute {MACHINE} {USER} Package 3BC68A08-3B6E-4138-BC79-4B124A37FF60 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:32.000 2013-06-18 17:57:32.000 0 0x
2501 PackageEnd {MACHINE} {USER} Package 3BC68A08-3B6E-4138-BC79-4B124A37FF60 086AEB95-717E-4EED-850F-A403BF4D4B0D 2013-06-18 17:57:32.000 2013-06-18 17:57:32.000 0 0x End of package execution.
我之前已经创建了查询,该查询具有表中字段的父子关系,但为此我需要识别出现在同一 sourceid 的 PackageStart 和 PackageEnd 或 OnPreExecute 和 OnPostExecute 事件之间的所有记录。
这还需要过滤为仅使用特定的 executionid,以便您分析包的一个实例(很容易在给定的 sourceid 和 PackageEnd 事件的 id 列上使用最大值,您可以识别单个 executionid)。
关于如何在 SQL 语句中将这些拼凑在一起的任何想法,因为这现在有点超出我的知识范围?