Which DMV to get database id for sys.dm_os_waiting_tasks

175 views Asked by At

Which DMV do I have to join with sys.dm_os_waiting_tasks to get the database ID?

1

There are 1 answers

0
Tyron78 On BEST ANSWER

You can try something as follows:

SELECT TOP 100 w.session_id, e.database_id, D.name
  FROM sys.dm_os_waiting_tasks w
  LEFT JOIN sys.dm_exec_sessions e ON w.session_id = e.session_id
  LEFT JOIN sys.databases d ON e.database_id = d.database_id