-- Connections
use tempdb

-- Examining Views
select * from sys.dm_exec_sessions

select * from sys.dm_exec_connections

select * from sys.dm_exec_requests


-- Who is currently logged in?
select 
		distinct login_name 
	from 
		sys.dm_exec_sessions 
	where 
		endpoint_id <> 0


-- What SQL statements are currently executing?
select 
		dbo.sql_text(sql_handle, statement_start_offset, statement_end_offset), 
		start_time,
		status
	from 
		sys.dm_exec_requests 
	where 
		connection_id is not null

