USE msdb;


SELECT j.[job_id], j.[name] AS [job_name], c.[name] AS [category_name], s.[next_run_date], s.[next_run_time], s.[schedule_id], 
TRY_CAST(
    CAST(s.[next_run_date] AS CHAR(8)) + ' ' +
    STUFF(STUFF(RIGHT('000000' + CAST(s.[next_run_time] AS VARCHAR(6)), 6), 3, 0, ':'), 6, 0, ':')
AS DATETIME) 
AS [next_run_datetime]

FROM [dbo].[sysjobs] j
    JOIN [dbo].[syscategories] c ON c.[category_id]=j.[category_id]
    JOIN [dbo].[sysjobschedules] s ON s.[job_id] = j.[job_id]
WHERE c.[name]='Database Maintenance'
ORDER BY j.[name];



