?
Solved

user lst

Posted on 2014-04-30
5
Medium Priority
?
280 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
[X]
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
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 600 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 1400 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 600 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

765 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