Solved

SQL Query to show all users logged into one instance

Posted on 2008-10-16
3
1,140 Views
Last Modified: 2012-05-05
I need to know write a query to show all users logged into a particular instance of a MS SQL 2005.

This instance contains multiple databases.

I know of sp_who and sp_who2 but that only seems to give me information for one database at a time.

I am looking for an aggregate of all users on all databases in a single instance.
0
Comment
Question by:hyphenpipe
3 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 22733929
select * from sys.dm_exec_sessions
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
ID: 22734000
sp_who and sp_who2 give you connections to every database.  That's why there is a dbName column.
0
 
LVL 6

Author Comment

by:hyphenpipe
ID: 22734202
You are correct.  I was to hasty in looking at the result set.  Thanks.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

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

23 Experts available now in Live!

Get 1:1 Help Now