SQL Query Samples For Unilever Reports
SQL Query Samples For Unilever Reports
terminationreason
CASE
WHEN s.retired = 0 THEN 'Active'
WHEN s.retired = 1 THEN 'Retired'
ELSE ' '
END as 'Retired',
s.name as 'Scheduler',
t.name as 'Task',
p.name as 'Process',
ts.resourcename as 'Resource',
st.startdate as 'Start On',
CASE
WHEN st.unittype = 0 THEN 'Once'
WHEN st.unittype = 1 THEN 'Hourly'
WHEN st.unittype = 2 THEN 'Daily'
WHEN st.unittype = 3 THEN 'Weekly'
WHEN st.unittype = 4 THEN 'Monthly'
WHEN st.unittype = 5 THEN 'Yearly'
WHEN st.unittype = 6 THEN 'Minutely'
ELSE ' '
END as 'Runs',
st.period as 'Every',
c.name as 'Calendar',
ts.processparams as 'ProcessParam'
from BPASchedule s
left JOIN BPATask t on s.id = t.scheduleid
left JOIN BPATaskSession ts on t.id = ts.taskid
left JOIN BPAProcess p on ts.processid = p.processid
left JOIN BPAScheduleTrigger st on s.id = st.scheduleid
left JOIN BPACalendar c on st.calendarid = c.id
where s.name is not null and st.enddate is null
-----------------------------------------------------------------------------------
-----------to chcek active and
retired------------------------------------------------------------------------