Here is a solution that doesn't use conversion to character string and back again.
select
next_run_date ,
next_run_time ,
NEXT_RUN_DATETIME =
-- convert date
dateadd(dd,((next_run_date)%100)-1,
dateadd(mm,((next_run_date)/100%100)-1,
dateadd(yy,(nullif(next_run_date,0)/10000)-1900,0)))+
-- convert time
dateadd(ss,next_run_time%100,
dateadd(mi,(next_run_time/100)%100,
--dateadd(hh,nullif(next_run_time,0)/10000,0)))
-- Fix for prior line, because a time of 0 is valid
dateadd(hh,@Time/10000,0)))
from
msdb.dbo.sysjobschedules AS s
Results:
next_run_date next_run_time NEXT_RUN_DATETIME
------------- ------------- -----------------------
20120109 131501 2012-01-09 13:15:01.000
20120107 113020 2012-01-07 11:30:20.000
20120109 105000 2012-01-09 10:50:00.000
20120107 20000 2012-01-07 02:00:00.000
20120107 51007 2012-01-07 05:10:07.000
20111221 200000 2011-12-21 20:00:00.000
20120106 170100 2012-01-06 17:01:00.000
20111221 163000 2011-12-21 16:30:00.000
20120110 34000 2012-01-10 03:40:00.000
0 0 NULL
20120106 181500 2012-01-06 18:15:00.000
20120107 500 2012-01-07 00:05:00.000
20120109 20010 2012-01-09 02:00:10.000
20120106 170200 2012-01-06 17:02:00.000
20120106 170000 2012-01-06 17:00:00.000
0 0 NULL
20120107 110007 2012-01-07 11:00:07.000
...
...
Edit to post bug fix.