Solved

How to list jobs from last 24 hours in a CommServeDB query?

  • 5 August 2022
  • 4 replies
  • 82 views

Userlevel 2
Badge +7

CommServe DB query

==================

SELECT startdate
   ,clientname
   ,idataagent
   ,instance
   ,backupset
   ,subclient
   ,backuplevel
   ,jobstatus
   ,jobid
FROM CommcellBackupInfo
WHERE jobstatus = 'Failed to Start'
and backuplevel = 'Synthetic Full'
and iDataAgent = 'Virtual Server' 
order by jobid desc ;

 

I was this list to contain  only the jobs from last 24 hours, how to add the time range in this sql query.

 


 

icon

Best answer by Jos Meijer 5 August 2022, 11:23

View original

4 replies

Userlevel 7
Badge +16
SELECT startdate
   ,clientname
   ,idataagent
   ,instance
   ,backupset
   ,subclient
   ,backuplevel
   ,jobstatus
   ,jobid
FROM CommcellBackupInfo
WHERE jobstatus = 'Failed to Start'
and backuplevel = 'Synthetic Full'
and iDataAgent = 'Virtual Server'
and startdate >= DATEADD(day, -1, GETDATE())
order by jobid desc ;

 

Userlevel 1
Badge +3

Jos, Meier you might know this. 
What’s the simplest way to achieve conditional and statements in a query.

google fails me.

Userlevel 7
Badge +16

something like this?

 

CASE
WHEN condition_1 AND condition_2 THEN result_1
ELSE result_2
END

 

Userlevel 3
Badge +10

Honestly I have to try it to be sure.

i want to use a check box to modify a where clause in a workflow.

even if it doesnt work this gives me a good idea what to try next. Thanks @Jos Meijer 

Reply