Skip to content

How to View Currently Executing Queries in SQL Server

November 12, 2009

Here’s a quick TSQL query to find the “currently executing queries” and the database name:

SELECT db.name,
er.session_id,
er.transaction_id,
er.start_time,
er.[status],
er.command,
er.wait_time
-- etc.
FROM sys.dm_exec_requests AS er
JOIN sys.sysdatabases AS db
ON er.database_id = db.dbid
WHERE er.status = 'running'

Here’s the query in action:

RunningQueries


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

  • Archives


  • RSS SQLServerPedia

  • RSS SQL Crunch – Hot SQL Links

  • My Bookmarks

  • Business Career DBA Tool Events free ebook Humor IT News Members Only Microsoft MySQL Operating System Oracle Personal Reporting Services SQL Server SQLServerPedia Syndication SSC SSIS TSQL Tutorial Uncategorized Video

  • Software Blogs - BlogCatalog Blog Directory
  • %d bloggers like this: