Find out how long the sql server service has been running, from t-sql

后端 未结 6 1389
春和景丽
春和景丽 2021-02-07 22:11

I\'d like if its possible to work out from inside sql server how long sql server has been running.

Would like to use this in conjunction with one of the DMV\'s for unuse

6条回答
  •  盖世英雄少女心
    2021-02-07 22:45

    SELECT
        login_time
    FROM
        sys.dm_exec_sessions
    WHERE
        session_id = 1
    

    will give you a datetime for when the server was started.

提交回复
热议问题