Which Transact-SQL statement should you use?

You administer a Microsoft SQL Server 2012.
A process that normally runs in less than 10 seconds has been running for more than an hour.
You examine the application log and discover that the process is using session ID 60.
You need to find out whether the process is being blocked.
Which Transact-SQL statement should you use?

You administer a Microsoft SQL Server 2012.
A process that normally runs in less than 10 seconds has been running for more than an hour.
You examine the application log and discover that the process is using session ID 60.
You need to find out whether the process is being blocked.
Which Transact-SQL statement should you use?

A.
EXEC sp_who 60

B.
SELECT * FROM sys.dm_exec_sessions WHERE sessionid = 60

C.
EXEC sp_helpdb 60

D.
DBCC INPUTBUFFER (60)

Explanation:
http://msdn.microsoft.com/en-us/library/ms174313.aspx
http://msdn.microsoft.com/en-us/library/ms176013.aspx
http://msdn.microsoft.com/en-us/library/ms178568.aspx
http://msdn.microsoft.com/en-us/library/ms187730.aspx



Leave a Reply 6

Your email address will not be published. Required fields are marked *


DEREJE

DEREJE

SELECT * FROM sys.dm_exec_sessions WHERE session_id = 60

Ryan

Ryan

Incorrect. Only sp_who returns information about the process being blocked. The answer is A

Mike Tucker

Mike Tucker

I thought it was sys.dm_exec_requests

I’d pick A from this list (EXEC sp_who 60)

rtaylor25

rtaylor25

Agreed with Mike Tucker.

EXEC sp_who 60 will give you the blocking SPID.

sys.dm_exec_requests also gives you this information but is not included in the list of answers

Afe

Afe

I agree with ‘rtaylor25’ and Mike Tucker