안녕하세요

현재 접근 유저세션, 인증타입을 보기 쉬운 쿼리입니다. 평소에 필요할때마다  만들어 쓰긴 했지만 알아보기 쉽게 만들어져 있네요

Current Users, Session Counts & Authentication Type

 

참고 링크: http://www.sqlservercentral.com/scripts/dm_exec_sessions/70285/

 

SELECT 'Authentication Method'=(

             CASE

                           WHEN nt_user_name IS not null THEN 'Windows Authentication'

                           ELSE 'SQL Authentication'

             END),

   login_name AS 'Login Name', ISNULL(nt_user_name,'-') AS 'Windows Login Name',

   COUNT(session_id) AS 'Session Count'

   FROM sys.dm_exec_sessions

   GROUP BY login_name,nt_user_name

   having (ISNULL(nt_user_name,'-') not in ('시작계정','SYSTEM')) AND login_name <> '관리자계정'

 





profile

차주언
MSSQL DBA ,  MCT/ MCDBA
SQL프런티어 /