-
Notifications
You must be signed in to change notification settings - Fork 0
/
sm-new-stale-removal.txt
35 lines (28 loc) · 2.93 KB
/
sm-new-stale-removal.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
/*
WHERE [OPEN] = 't' AND CURRENT_PHASE = 'New' AND ORIG_DATE_ENTERED < DATEADD(d , -30, GETDATE()) AND PLANNED_START < GETDATE()
WHERE [OPEN] = 't' AND CURRENT_PHASE = 'New' AND ORIG_DATE_ENTERED < DATEADD(d , -30, GETDATE()) AND (PLANNED_START < GETDATE() OR PLANNED_START IS NULL)
WHERE [OPEN] = 't' AND CURRENT_PHASE = 'New' AND ORIG_DATE_ENTERED < DATEADD(d , -30, GETDATE()) AND (PLANNED_START >= GETDATE() OR PLANNED_START IS NULL)
WHERE [OPEN] = 't' AND CURRENT_PHASE = 'New' AND ORIG_DATE_ENTERED < DATEADD(d , -30, GETDATE()) AND PLANNED_START IS NULL
WHERE [OPEN] = 't' AND CURRENT_PHASE = 'New' AND ORIG_DATE_ENTERED < DATEADD(d , -30, GETDATE()) AND PLANNED_START <= GETDATE()
WHERE [OPEN] = 't' AND CURRENT_PHASE = 'New' AND ORIG_DATE_ENTERED < DATEADD(d , -30, GETDATE()) AND (PLANNED_START IS NULL OR PLANNED_START <= GETDATE())
ORDER BY PLANNED_START
ORDER BY NUMBER
DECLARE @MyRFC varchar(20) ; SET @MyRFC = 'CM0004947'
SELECT NUMBER,CURRENT_PHASE,ORIG_DATE_ENTERED
FROM CM3RM1
WHERE NUMBER = @MyRFC
SELECT NUMBER
FROM CM3RM2
WHERE NUMBER = @MyRFC
SELECT NUMBER
FROM CM3RA1
WHERE NUMBER = @MyRFC
SELECT NUMBER
FROM CM3RA2
WHERE NUMBER = @MyRFC
*/
SELECT NUMBER,CURRENT_PHASE,ORIG_DATE_ENTERED,PLANNED_START,[OPEN]
FROM CM3RM1
WHERE [OPEN] = 't' AND CURRENT_PHASE = 'New' AND ORIG_DATE_ENTERED < DATEADD(d , -30, GETDATE()) AND (PLANNED_START IS NULL OR PLANNED_START <= GETDATE())
ORDER BY NUMBER