Solved

SQL Server: How display current connections to a database and/or table?

Posted on 2009-06-30
4
2,024 Views
Last Modified: 2012-06-27
Is there a stored procedure or UI command that shows the current live connections to a particular database and more importantly to a table (if possible)?  

For instance, a list of users and when they connected, and what the connection is doing?

MySQL has something like this called "show processlist."  Was wondering if SQL Server had something similar.


show processlist;        [MySQL]

Open in new window

0
Comment
Question by:ZuZuPetals
4 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 125 total points
ID: 24748083
you can see the connections to a database thru   'sp_who2 ' but you wont get the info on the connections to a table
0
 
LVL 17

Assisted Solution

by:pssandhu
pssandhu earned 125 total points
ID: 24748106
You can set up a trace in SQL Profiler and that will show you scripts users are running and determine what tables they are running.
P
0
 
LVL 42

Assisted Solution

by:EugeneZ
EugeneZ earned 125 total points
ID: 24748110
exec sp_who
exec sp_who2
 
Select * from master..sysprocesses
more
sp_who
http://msdn.microsoft.com/en-us/library/aa260384(SQL.80).aspx
 
sysprocesses table
http://msdn.microsoft.com/en-us/library/aa260456(SQL.80).aspx
 
---
 
and use sql profiler to see what is running
http://msdn.microsoft.com/en-us/library/ms979207.aspx 
0
 
LVL 57

Assisted Solution

by:Raja Jegan R
Raja Jegan R earned 125 total points
ID: 24748116
Using sp_who2 will help you out.

But DMV's are recommended to start from SQL Server 2005.

SELECT * FROM sys.dm_exec_connections
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Abstract Express Replacement Software 12 28
SQL Querying data from 3 tables, all with 1 common column 4 37
Querying data from 3 SQL tables 2 32
T-SQL: "HAVING CASE" Clause 1 27
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

832 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