How we could find tables which are currently under delete operation or locked for delete operation?
I wanted to list such table. Is there any way to list out?
How we could find tables which are currently under delete operation or locked for delete operation?
I wanted to list such table. Is there any way to list out?
I have used this code for a similar situation, Let me know if it worked fine :
SELECT p.spid
,convert(char(12), d.name) db_name
, program_name
, p.loginame
, convert(char(12), hostname) hostname
, cmd
, p.status
, p.blocked
, login_time
, last_batch
, p.spid
FROM master..sysprocesses p
JOIN master..sysdatabases d ON p.dbid = d.dbid
WHERE EXISTS ( SELECT 1
FROM master..sysprocesses p2
WHERE p2.blocked = p.spid )
and cmd like '%DELETE%'