• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2496
  • Last Modified:

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

0
gudidi
Asked:
gudidi
1 Solution
 
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now