Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT ci.UserName
- ,ISNULL(un.UserDesc,'') AS UserDesc
- ,'YOURDB' AS Configuration
- ,ci.CreateDate AS CreateDate
- ,SUBSTRING(ci.CreationContext, CHARINDEX('ClientHost=',ci.CreationContext)+11 , CHARINDEX(';',ci.CreationContext,CHARINDEX('ClientHost=',ci.CreationContext)+11) - (CHARINDEX('ClientHost=',ci.CreationContext)+11)) AS ComputerName
- FROM [YOURDB].dbo.connectioninformation ci
- JOIN UserNames un
- ON un.UserName = ci.UserName
- WHERE ci.SessionType = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement