Since you have this information in three different fields, one way to do this is treating this info as text to show it in the format you want (which, I guess, it will be hh:mm:ss)
Then you’ll be able to convert to whatever time you want (how to do this conversion depends on the database you use and you should refer to their manual)
SELECT CONVERT(TIME,
CAST(TotalTimeSpentHrs AS CHAR(2)) + ':' +
CAST(TotalTimeSpentMin AS CHAR(2)) + ':' +
CAST(TotalTimeSpentSec AS CHAR(2)),108) AS totaltime
FROM EST1
[quote=“lostty84, post:6, topic:102251, full:true”]
I AM GETTING
Conversion failed when converting date and/or time from character string.
[/quote]try this –
SELECT CONVERT(TIME,'12:15:23',108) AS test_time
if this works, is it possible that you have one of those three column values out of range?
SELECT 'yes, bad data'
FROM EST1
WHERE TotalTimeSpentHrs > 23
OR TotalTimeSpentMin > 59
OR TotalTimeSpentSec > 59
if this returns 0 rows, then probably the CAST from float to CHAR(2) didn’t work…
[quote=“lostty84, post:10, topic:102251, full:true”]and the second query works, and it returns two rows
yes, bad data
yes, bad data
[/quote]well, there’s your reason for the failed conversion
looks like you will have to compute total seconds after all, and then convert the final number back to a time