Which SQL Statements are Currently Executing on my Database? | SansSQL

Thursday, November 13, 2008

Which SQL Statements are Currently Executing on my Database?

SELECT [Spid] = session_Id
, ecid
, [Database] = DB_NAME(sp.dbid)
, [User] = nt_username
, [Status] = er.status
, [Wait] = wait_type
, [Individual Query] = SUBSTRING (qt.text, er.statement_start_offset/2,
(CASE WHEN er.statement_end_offset = -1
ELSE er.statement_end_offset END - er.statement_start_offset)/2)
,[Parent Query] = qt.text
, Program = program_name
, Hostname
, nt_domain
, start_time
FROM sys.dm_exec_requests er
INNER JOIN sys.sysprocesses sp ON er.session_id = sp.spid
CROSS APPLY sys.dm_exec_sql_text(er.sql_handle) as qt
WHERE session_Id > 50 -- This is to ignore system SPID's.
AND session_Id NOT IN (@@SPID) -- This is to ignore this current Statement/Session.


Huongkv said...

Mua vé tại Aivivu, tham khảo

vé máy bay đi Mỹ giá rẻ

các chuyến bay từ mỹ về việt nam hôm nay

ve may bay tu canada ve viet nam

vé máy bay về việt nam từ nhật

Có chuyến bay từ Hàn Quốc về Việt Nam không

Vé máy bay từ Đài Loan về Việt Nam

khách sạn cách ly

vé máy bay cho chuyên gia nước ngoài

Anonymous said...

You provide the informative information related to database in detail. I learn more through this post. Further, The power washing services Boston present the outstanding work.

MartenJames said...

In short time, we got best knowledge from your article. We are always here to provide you Professional Floor Repair Services Chicago IL that are trusted and budget-friendly.

Jone Martin said...

I had read your reviews. developers are happy from you. You keep them update toward the SQL updations.
Likely, I am updating you about the Local Moving Services in Atlanta GA. This give you reliable service and rapid response.

jackman10 said...

Unquestionably believe that which you said. Your favorite reason seemed to be on the net the simplest thing to be aware of. I say to you, I certainly get annoyed while people think about worries that they plainly do not know about. You managed to hit the nail upon the top and also defined out the whole thing without having side-effects , people can take a signal. Will probably be back to get more. Thanks hackers for hire reviews

Post a Comment