16 March 2015

SQL: convert int to date wiith AGENT_DATETIME

MSDB function to convert from int to datetime!
SELECT no_time = msdb.dbo.agent_datetime(20150119, 0)

Result:
no_time
-----------------------
2015-01-19 00:00:00.000


With time:
SELECT with_time = msdb.dbo.agent_datetime(20150119, 171911)

Result:
with_time
-----------------------
2015-01-19 17:19:11.000