?
Solved

SQL Query to show all users logged into one instance

Posted on 2008-10-16
3
Medium Priority
?
1,151 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
[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
3 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 2000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

777 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