• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 286
  • Last Modified:

user lst

Hello,

Is there is tsql query or anything to pull the list of active user in a sql server?

thank you
0
Rayne
Asked:
Rayne
  • 2
  • 2
3 Solutions
 
RayneAuthor Commented:
pull list of all users in a server...basically
0
 
dannygonzalez09Commented:
You can use Exec sp_who to get the list of all active connections
0
 
Steve WalesSenior Database AdministratorCommented:
Not sure if you're after active sessions, or actual list of logins on the server.

To get the list of logins from your server:

use master
go
select * from sys.server_principals where type in ('S','G','U');

Open in new window

(This is what you see if you expand Security / Logins from SSMS Object Explorer).
0
 
dannygonzalez09Commented:
You can use the below query to get the list of active users per database


SELECT DB_NAME(dbid) as 'Database', COUNT(dbid) as nnections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame
0
 
RayneAuthor Commented:
thank you all :)
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now