I have a query related to a DBA activity.
Using msdb database system tables like sysjob, sysjobhistory, sysjobsteps and sysjobactivity.
I’m trying to find all the job start time, end time and run duration for every step ID.
I got the above values but for End time, I’m adding start time + duration but the End Time is coming wrong when the minutes go above 60 mins.
The start time original was in 6 digits but then using stuff and cast functions I have brought that in time format and so may be for End time =start time + duration is not rounding off the hours it is showing 7:71:34 instead of 8:11:34.
For example I have attached the logic that I’m using and the sample screenshot of the issue.
[![enter image description here][1]][1]
Please let me know if anyone has any idea.
Thank you in advance.