I have a column stop_execution_date in sysjobactivity table. I need to get details of job only which ran after 4:10 AM.
I tried it using
cast(DATEPART(hour, sja.stop_execution_date) as varchar)+cast(DATEPART(minute, sja.stop_execution_date) as varchar) >410
But, if job completes at 9:05 AM it is not accepting because datepart(hour) is 9 and datepart(minute) is 5. By using + we are getting 95 instead of 905, which is less then 410.
Can you please suggest me a good way to do that.
Time subtraction: result = time1 - time2 If MINUTE( TIME2 ) <= MINUTE( TIME1 ) then MINUTE( RESULT ) = MINUTE( TIME1 ) - MINUTE( TIME2 ) . If MINUTE( TIME2 ) > MINUTE( TIME1 ) then MINUTE( RESULT ) = 60 + MINUTE( TIME1 ) - MINUTE( TIME2 ) and HOUR( TIME2 ) is incremented by 1.
MySQL MINUTE() Function The MINUTE() function returns the minute part of a time/datetime (from 0 to 59).
How about:
(DATEPART(hour, sja.stop_execution_date) = 4 and (DATEPART(minute, sja.stop_execution_date) > 10)
OR DATEPART(hour, sja.stop_execution_date) > 4
Could cast as a time.
cast(sja.stop_execution_date as time) > '04:10:00.0000000'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With