You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
INNER JOIN report_subscription AS s ON s.[Report_OID] = c.[ItemID]
384
-
LEFT JOIN
385
-
(
386
-
SELECT
387
-
b.[ReportID]
388
-
, b.[Status]
389
-
, b.[TimeEnd]
390
-
, [LastRunTime] = CAST(CONVERT(CHAR(16), b.[TimeEnd], 113) AS DATETIME)
391
-
FROM
392
-
dbo.[ExecutionLog] b
393
-
INNER JOIN (SELECT [ReportID], MAX([TimeEnd]) AS [TimeEnd] FROM dbo.[ExecutionLog] GROUP BY [ReportID]) a ON b.[ReportID] = a.[ReportID] AND b.[TimeEnd] = a.[TimeEnd]
394
-
GROUP BY
395
-
b.[ReportID]
396
-
, b.[Status]
397
-
, b.[TimeEnd]
398
-
)AS el ON el.[ReportID] = c.[ItemID]
399
-
LEFT JOIN report_users AS urc ON c.[CreatedById] = urc.[UserID]
400
-
LEFT JOIN report_users AS urm ON c.[ModifiedById] = urm.[UserID]
401
-
LEFT JOIN report_users AS usc ON s.[OwnerID] = usc.[UserID]
402
-
LEFT JOIN report_users AS usm ON s.[ModifiedByID] = usm.[UserID]
403
-
WHERE
404
-
1=1
405
-
AND c.[Type] = 2
406
-
AND (@all_value IN (@ReportFolder) OR c.[ReportFolder] IN(@ReportFolder))
407
-
AND (@all_value IN (@ReportFolder) OR CHARINDEX(@ReportFolder, c.[ReportPath]) > 0)
331
+
, [ReportCreatedBy] = urc.[SimpleUserName]
332
+
, c.[ReportCreationDate]
333
+
, [ReportModifiedBy] = urm.[SimpleUserName]
334
+
, c.[ReportModifiedDate]
335
+
, [SubscriptionOwner] = usc.[SimpleUserName]
336
+
, [SubscriptionModifiedBy] = usm.[SimpleUserName]
337
+
, [SubscriptionModifiedDate] = s.[ModifiedDate]
338
+
, s.[SubscriptionID]
339
+
, s.[SubscriptionDescription]
340
+
, s.[ExtensionSettings]
341
+
, s.[EventType]
342
+
, s.[EmailSubject]
343
+
, s.[EmailTo]
344
+
, s.[EmailCc]
345
+
, s.[EmailBcc]
346
+
, s.[EmailComment]
347
+
, s.[EmailIncludeLink]
348
+
, s.[EmailRenderFormat]
349
+
, s.[EmailPriority]
350
+
, s.[DeliveryExtension]
351
+
, s.[SubscriptionLastStatus]
352
+
, s.[StatusFail]
353
+
, s.[MatchData]
354
+
, s.[RunTime]
355
+
, s.[LastRunDate]
356
+
, s.[LastRunTime]
357
+
, s.[MinutesInterval]
358
+
, s.[DaysInterval]
359
+
, s.[WeeksInterval]
360
+
, s.[DaysOfWeek]
361
+
, s.[DaysOfMonth]
362
+
, s.[Month]
363
+
, s.[MonthlyWeek]
364
+
, [JobName] = NULL --, s.[JobName]
365
+
, s.[ScheduleName]
366
+
, s.[ScheduleDays]
367
+
, s.[SchDaySun]
368
+
, s.[SchDayMon]
369
+
, s.[SchDayTue]
370
+
, s.[SchDayWed]
371
+
, s.[SchDayThr]
372
+
, s.[SchDayFri]
373
+
, s.[SchDaySat]
374
+
, s.[ScheduleStartDate]
375
+
, s.[ScheduleEndDate]
376
+
, s.[Flags]
377
+
, s.[RecurrenceType]
378
+
, s.[State]
379
+
, [EventStatus] = el.[Status]
380
+
, [EventDateTime] = el.[TimeEnd]
381
+
FROM
382
+
report_catalog AS c
383
+
INNER JOIN report_subscription AS s ON s.[Report_OID] = c.[ItemID]
384
+
LEFT JOIN
385
+
(
386
+
SELECT
387
+
b.[ReportID]
388
+
, b.[Status]
389
+
, b.[TimeEnd]
390
+
, [LastRunTime] = CAST(CONVERT(CHAR(16), b.[TimeEnd], 113) AS DATETIME)
391
+
FROM
392
+
ReportServer.dbo.[ExecutionLog] b
393
+
INNER JOIN (SELECT [ReportID], MAX([TimeEnd]) AS [TimeEnd] FROM ReportServer.dbo.[ExecutionLog] GROUP BY [ReportID]) a ON b.[ReportID] = a.[ReportID] AND b.[TimeEnd] = a.[TimeEnd]
394
+
GROUP BY
395
+
b.[ReportID]
396
+
, b.[Status]
397
+
, b.[TimeEnd]
398
+
)AS el ON el.[ReportID] = c.[ItemID]
399
+
LEFT JOIN report_users AS urc ON c.[CreatedById] = urc.[UserID]
400
+
LEFT JOIN report_users AS urm ON c.[ModifiedById] = urm.[UserID]
401
+
LEFT JOIN report_users AS usc ON s.[OwnerID] = usc.[UserID]
402
+
LEFT JOIN report_users AS usm ON s.[ModifiedByID] = usm.[UserID]
403
+
WHERE
404
+
1=1
405
+
AND c.[Type] = 2
406
+
AND (@all_value IN (@ReportFolder) OR c.[ReportFolder] IN(@ReportFolder))
407
+
AND (@all_value IN (@ReportFolder) OR CHARINDEX(@ReportFolder, c.[ReportPath]) > 0)
408
408
AND (@all_value IN(@ReportName) OR c.[Name] IN(@ReportName))
409
409
AND (@all_value IN(@EventStatus) OR el.[Status] IN(@EventStatus))
410
410
AND (@all_value IN(@Current) OR CASE WHEN s.[ScheduleEndDate] IS NULL THEN 'Current' WHEN s.[ScheduleEndDate] IS NOT NULL THEN 'Non Current' END = @Current)
0 commit comments