SQL Server View in progress

Source: Internet
Author: User

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 is Er.statement_end_offset =-1 Then LEN (C Onvert (NVARCHAR (MAX), Qt.text))

* 2 ELSE Er.statement_end_offset End-er.statement_start_offset)/2),

[Parent Query] = Qt.text,

program = Program_name, Hostname,

Nt_domain,getdate (), 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 >/* Ignore system spids.*/and session_id not in (@ @SPID)

ORDER BY start_time ASC


SQL Server View in progress

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.