• There's a much simpler way to do this:

    select ServerUptimeInHrs = datediff(hh, Login_time, current_timestamp)

    from sys.dm_exec_sessions

    where session_id = 1

    That gives you the hours, obviously days, minutes or whatever are just as easy to calculate...

    /*****************

    If most people are not willing to see the difficulty, this is mainly because, consciously or unconsciously, they assume that it will be they who will settle these questions for the others, and because they are convinced of their own capacity to do this. -Friedrich August von Hayek

    *****************/