Solved

user lst

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

757 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

19 Experts available now in Live!

Get 1:1 Help Now