• Use the DATEDIFF functions ...

    for example

    SELECT DATEDIFF ( datepart , startdate , enddate )

    This will return the number of days difference.

    SELECT DATEDIFF(d,'2013-04-05 10:45:41.013','2013-04-07 14:45:41.013')

    returns 2 days

    This returns the total number of hours difference (52)

    SELECT DATEDIFF(hh,'2013-04-05 10:45:41.013','2013-04-07 14:45:41.013')

    --combining every thing I think will give you what you are looking for:

    SELECT DATEDIFF(hh,'2013-04-05 10:45:41.013','2013-04-07 14:45:41.013')/24 AS 'Days'

    ,DATEDIFF(hh,'2013-04-05 10:45:41.013','2013-04-07 14:45:41.013') -

    (DATEDIFF(hh,'2013-04-05 10:45:41.013','2013-04-07 14:45:41.013')/24)*24 AS 'Hours'

    Result:

    DaysHours

    24

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]