Vytux

  • Increase font size
  • Default font size
  • Decrease font size
Home FAQ Usefull Code List all user connected to a database

Create PDF Email Print

List all user connected to a database

Author:
Vytautas
Date added:
Thursday, 26 February 2009

Answer

The following query will list all users and information who are connected to the specified database.
1
2
3
SELECT spid, status, loginame, hostname, blocked, DB_NAME(dbid) AS database_name, cmd 
FROM master..sysprocesses 
WHERE DB_NAME(dbid) = 'your_db_name'

This is best run under a administrative user such as 'sa' if you want to display all users, otherwise only users you are allowed to see will be shown.

Category

Tags for this item

Discount Hotel Reservation - HotelClub

Sponsored Links


Lithuanian Name Days


Yesterday (2010-09-11) : Girmantė, Konstancija, Mikalojus, Tautgirdas
Today (2010-09-12) : Augantas, Gytautė, Gytė, Hetga
Tomorrow (2010-09-13) : Gvidas, Marija, Tolvaldas, Vaidmantė
Made by: Vytux!