Solved

SQL Query to show all users logged into one instance

Posted on 2008-10-16
3
1,138 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
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…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now