Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Summing time

Author  Topic 

bjornh
Yak Posting Veteran

87 Posts

Posted - 2002-12-28 : 07:42:30
Hi there,

I've got a table to track my working hours. (it's in access, but sinds it's a SQL question so I hope you guys can still give me a answer).

There are 2 columns, 'Start' and 'end'. Both Datetime type.

I used the query 'SELECT cdate(sum(end-start)) from hours' And it works, but when I work more than 24 hours, you get something like this: '31-12-1899 2:00:00' so it doens't go beyond 24 hours. Is there a way to get this working, or do I need to use int types....

Thanks

Bjorn

skillile
Posting Yak Master

208 Posts

Posted - 2002-12-28 : 08:21:59
Check out DATEDIFF

SELECT DATEDIFF(hh, getdate(),( getdate()+2) ) as hoursdiff

slow down to move faster...
Go to Top of Page
   

- Advertisement -