Tags: sys.dm_exec_sessions

Checking the running time since last SQL-Server instance startup

Below script will query sys.dm_exec_sessions to find out how long the SQL-Server instance is running.DECLARE @elapsed_time AS DATETIME, @lr_start_time AS DATETIMESELECT @lr_start_time = (SELECT last_request_start_time FROM sys.dm_exec_ses… more »