Solved

user lst

Posted on 2014-04-30
5
272 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

839 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