SELECT sqlserver_start_time FROM sys.dm_os_sys_info; -- available only for SQL SERVER 2008 and up
sqlserver_start_time is not exists for SQL Server versions before 2008, so there you can get the last restart time using one of these:
SELECT create_date FROM sys.databases WHERE name = 'tempdb'
SELECT login_time FROM sys.dm_exec_sessions WHERE session_id = 1
No comments:
Post a Comment