• There's a system function shipped as part of msdb that turns an integer date and an integer time into a DATETIME. Being undocumented, using it directly isn't be supported (and it might be changed or removed in future with no deprecation cycle). It is unchanged in the latest SQL Server 2012 preview though. Anyway, it's called dbo.agent_datetime, and has the following definition:

    CREATE FUNCTION agent_datetime(@date int, @time int)

    RETURNS DATETIME

    AS

    BEGIN

    RETURN

    (

    CONVERT(DATETIME,

    CONVERT(NVARCHAR(4),@date / 10000) + N'-' +

    CONVERT(NVARCHAR(2),(@date % 10000)/100) + N'-' +

    CONVERT(NVARCHAR(2),@date % 100) + N' ' +

    CONVERT(NVARCHAR(2),@time / 10000) + N':' +

    CONVERT(NVARCHAR(2),(@time % 10000)/100) + N':' +

    CONVERT(NVARCHAR(2),@time % 100),

    120)

    )

    END