Stan,
Since SQL 2005 and earlier only has a datetime data type, then your time
needs to have a date. You can ignore the date as needed and deal only with
the time.
SELECT DATEADD(second, MySecondsColumn, 0);
Assuming that there were 12312 seconds, this would return:
1900-01-01 03:35:12.000
If you want to add the seconds to today's date, then:
SELECT DATEADD(second, MySecondsColumn,
-- Use date math to set the GETDATE time to 0
DATEADD(day, DATEDIFF(day,0,GETDATE()),0));
Whatever the date is, you can get the time by using the appropriate CONVERT
parameters. For example:
SELECT CONVERT(VARCHAR(12), DATEADD(second, MySecondsColumn,0),114)
RLF
"Stan" wrote in message
> We have a SQL 2005 database that has the time stored as an integer. I'm
> assuming it is the seconds after midnight. Is there a function to convert
> this to a readable time?
> Thanks
> --
> Stan Gosselin
>> Stay informed about: Converting integer time