Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1161
  • Last Modified:

SQL Query to show all users logged into one instance

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
hyphenpipe
Asked:
hyphenpipe
1 Solution
 
chapmandewCommented:
select * from sys.dm_exec_sessions
0
 
BrandonGalderisiCommented:
sp_who and sp_who2 give you connections to every database.  That's why there is a dbName column.
0
 
hyphenpipeAuthor Commented:
You are correct.  I was to hasty in looking at the result set.  Thanks.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now