Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use AX2012_GRD_WORK
- select *
- --into desh.dbo.locks
- from (
- SELECT dm_tran_locks.request_session_id,
- dm_tran_locks.resource_database_id,
- DB_NAME(dm_tran_locks.resource_database_id) AS dbname,
- CASE
- WHEN resource_type = 'OBJECT'
- THEN OBJECT_NAME(dm_tran_locks.resource_associated_entity_id)
- ELSE OBJECT_NAME(partitions.OBJECT_ID)
- END AS ObjectName,
- partitions.index_id,
- indexes.name AS index_name,
- dm_tran_locks.resource_type,
- RTRIM(dm_tran_locks.resource_description) as resource_description,
- dm_tran_locks.resource_associated_entity_id,
- dm_tran_locks.request_mode,
- dm_tran_locks.request_status,
- dm_exec_sessions.host_name,
- dm_exec_sessions.host_process_id,
- cast(dm_exec_sessions.context_info as varchar(128)) as context_info
- FROM sys.dm_tran_locks
- LEFT JOIN sys.partitions ON partitions.hobt_id = dm_tran_locks.resource_associated_entity_id
- LEFT JOIN sys.indexes ON indexes.OBJECT_ID = partitions.OBJECT_ID AND indexes.index_id = partitions.index_id
- LEFT JOIN sys.dm_exec_sessions ON dm_exec_sessions.session_id = dm_tran_locks.request_session_id
- WHERE 1=1
- AND resource_associated_entity_id > 0
- AND resource_database_id = DB_ID()
- AND request_session_id in (618)
- ) T
- where 1=1
- --and objectname like N'REQCALCTASKSBUNDLE'
- --and index_name = 'I_417RECID'
- --and resource_type = 'KEY'
- --and request_mode = N'U'
- --and resource_description in (
- --select %%lockres%% from SPECTRANS WITH(NOLOCK INDEX(I_417RECID))
- --where SPECRECID = 22565455015)
- --and request_status = N'WAIT'
- ORDER BY request_session_id, ObjectName, index_name, resource_description
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement