user lst

Posted on 2014-04-30
Last Modified: 2014-04-30

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

thank you
Question by:Rayne
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Author Comment

ID: 40032372
pull list of all users in a server...basically

Assisted Solution

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

Accepted Solution

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
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).

Assisted Solution

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

Author Closing Comment

ID: 40032616
thank you all :)

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
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…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

705 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