convert data type TIME to int or float

Hi Experts

i use SQL 2008 data type TIME.
because i need to find avarage of time i need to convert it to number.

don't find example to do it.

this is the query:

select min(TIME_RECORD)
from HISTORY_DATA

10x

gudidiAsked:
Who is Participating?
 
Pratima PharandeCommented:
time to int conversion is not allowed

refer

http://msdn.microsoft.com/en-us/library/ms187928.aspx
0
 
bmatumburaCommented:
Try this:
select min(DATEPART(hh, TIME_RECORD) * 24 + DATEPART(mi, TIME_RECORD) * 60 + DATEPART(ss, TIME_RECORD))
from HISTORY_DATA

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.