Solved

user lst

Posted on 2014-04-30
5
270 Views
Last Modified: 2014-04-30
Hello,

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

thank you
0
Comment
Question by:Rayne
  • 2
  • 2
5 Comments
 

Author Comment

by:Rayne
ID: 40032372
pull list of all users in a server...basically
0
 
LVL 5

Assisted Solution

by:dannygonzalez09
dannygonzalez09 earned 150 total points
ID: 40032399
You can use Exec sp_who to get the list of all active connections
0
 
LVL 22

Accepted Solution

by:
Steve Wales earned 350 total points
ID: 40032402
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
 
LVL 5

Assisted Solution

by:dannygonzalez09
dannygonzalez09 earned 150 total points
ID: 40032410
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
 

Author Closing Comment

by:Rayne
ID: 40032616
thank you all :)
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now