Hi @Rachel ,
Why the 1st connection still holds the table lock after running this stored procedure?
Maybe it is not be committed, try code commit tran
will sove the issue.
Verify it is blocked by this stored procedure or not:
--CHECK WAITTIME SPID DBID
select * from sys.sysprocesses
--check resource and objectid
sp_lock
--check table
select * from sys.objects where object_id = ' '
--check t_sql
select * from sys.dm_exec_requests as p
cross apply sys.dm_exec_sql_text (p.sql_handle) as qt where p.session_id >50
How to make sure the table lock is released?
Firstly find the SPID and then commit it or kill it.
--check open tran
DBCC OPENTRAN
--kill tran
Kill SPID
--commit tran
Commit tran
More information: inf-understanding-and-resolving-sql-server-blocking-problems
BR,
Mia
If the answer is helpful, please click "Accept Answer" and upvote it.