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)
 date diff

Author  Topic 

MattieBala69
Starting Member

30 Posts

Posted - 2005-09-13 : 13:20:52
Hey ,
I am really lost . There is this access code where it takes out the diff in datetime.
eg. 08/02/2002 12:00:00.000 AM - 07/06/2005 4:20:04.000 PM = -1069.68060185185.(IT ROUNDS IT TO 1070)

how would i get this in sql server. when i try it in sql it the answer i get is 1069. I NEED THIS TO BE ROUNDED TO 1070.
is there any way i can do this. this this the sql code i wrote
DATEDIFF (mi, FT.llfRecdDate,A.llaCompleteDate )/ 60)/24
Thank you,
Mattie

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2005-09-13 : 13:50:56
Here's one way:
(use ceiling instead of round if you always want to round up)

select round(datediff(hour, '08/02/2002 12:00:00.000 AM', '07/06/2005 4:20:04.000 PM')/24.0,0)

Be One with the Optimizer
TG
Go to Top of Page

MattieBala69
Starting Member

30 Posts

Posted - 2005-09-13 : 14:10:27
u are the best :-)
THank you soooooooooooooo much
Mattie
Go to Top of Page
   

- Advertisement -