-
Notifications
You must be signed in to change notification settings - Fork 0
/
sp_SD_AuditProcessInfo.txt
60 lines (59 loc) · 1.79 KB
/
sp_SD_AuditProcessInfo.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
USE [ProcessManager]
GO
/****** Object: StoredProcedure [dbo].[sp_SD_AuditProcessInfo] Script Date: 21/04/2016 16:15:01 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Brent Ring
-- bring@symantec.com
-- https://www-secure.symantec.com/connect/user/bring
-- Alex Hedley
-- https://www-secure.symantec.com/connect/user/alexhedley
-- Create date: 22 Aug 2013
-- : 15 Apr 2016
-- Description: Send Incident to Workflow - Auditing Incident Owner and Service Queue Changes
-- https://www-secure.symantec.com/connect/videos/send-incident-workflow-auditing-incident-owner-and-service-queue-changes
-- Taken from the video and made into a SP.
-- =============================================
CREATE PROCEDURE [dbo].[sp_SD_AuditProcessInfo]
-- Add the parameters for the stored procedure here
@sessionid UniqueIdentifier
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT
[audit_process_info_id]
,[incident_session_id]
,[assigned_to_queue_name]
,[assigned_on_date]
--,[assigned_away_date]
,CASE
WHEN [assigned_away_date] = '1753-01-01 00:00:00.000'
THEN
NULL
ELSE
[assigned_away_date]
END
AS [assigned_away_date]
,CASE
WHEN [assigned_away_date] = '1753-01-01 00:00:00.000'
THEN
NULL
ELSE
DATEDIFF(mi, [assigned_on_date], [assigned_away_date])
END
AS [time_in_queue]
--,[time_in_queue]
,[current_assignment]
FROM
[audit_process_info]
WHERE
[incident_session_id] = @sessionid
ORDER BY
[assigned_on_date] DESC
END