• Dear Jeffrey,

    My application needs to store the dates as Decimal for some requirement, and your opinion to convert the decimal into date is right, and I was trying to write the query for this conversion.

    Any way, I tried your query, but there is an error that I could not figure it out...this is because I did not use the STUFF function before and have no idea how it works.

    please try to use your query in your SQL server 2005 and check if every thing works well or not.

    This is your query with one ")" I think you missed:

    SELECT * FROM MyTable

    WHERE convert(datetime, cast(DayTransDate AS char(8))

    + ' ' + STUFF(STUFF(CAST(DayTransTime AS char(6), 5, 0, ':'), 3, 0, ':')))

    > DATEADD(minute, -30, getdate());

    With my best Regards to you...