Float as DateTime
Posted
by lp1
on Stack Overflow
See other posts from Stack Overflow
or by lp1
Published on 2010-05-12T20:33:15Z
Indexed on
2010/05/12
21:44 UTC
Read the original article
Hit count: 224
sql-server
|sql-server-2008
SQL Server 2008
I almost have, I think, what I'm looking to do. I'm just trying to fine tune the result. I have a table that stores timestamps of all transactions that occur on the system. I'm writing a query to give an average transaction time. This is what I have so far:
With TransTime AS (
select endtime-starttime AS Totaltime
from transactiontime
where starttime > '2010-05-12' and endtime < '2010-05-13')
Select CAST(AVG(CAST(TotalTime As Float))As Datetime)
from TransTime
I'm getting the following result:
1900-01-01 00:00:00.007
I can't figure out how to strip the date off and just display the time, 00:00:00:007. Any help would be appreciated. Thank you.
© Stack Overflow or respective owner