Easy enough to do with the code below.Notice how it rounds down to one day when the difference is 1 day 11:59:59.997, and up to 2 when the difference is 1 day 12:00:00.000.select DayDiff = datediff(dd,0,EndDate-StartDate+'12:00:00.000'), *from ( -- Test Data select StartDate = convert(datetime,'2007-08-03 14:29:00.310'), EndDate = convert(datetime,'2008-08-15 00:00:00.000') union all select StartDate = convert(datetime,'2007-08-03 14:29:00.310'), EndDate = convert(datetime,'2008-08-15 12:00:00.000') union all select StartDate = convert(datetime,'2007-08-03 00:00:00.000'), EndDate = convert(datetime,'2007-08-04 11:59:59.997') union all select StartDate = convert(datetime,'2007-08-03 00:00:00.000'), EndDate = convert(datetime,'2007-08-04 12:00:00.000') ) aResults:DayDiff StartDate EndDate----------- ----------------------- -----------------------377 2007-08-03 14:29:00.310 2008-08-15 00:00:00.000378 2007-08-03 14:29:00.310 2008-08-15 12:00:00.0001 2007-08-03 00:00:00.000 2007-08-04 11:59:59.9972 2007-08-03 00:00:00.000 2007-08-04 12:00:00.000(4 row(s) affected)
CODO ERGO SUM