View the locked table:
select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName
from sys.dm_tran_locks where resource_type='OBJECT'
spid lock table process
tableName locked table name
Unlock:
declare @spid int
Set @spid = 57 --lock table process
declare @sql varchar(1000)
set @sql='kill '+cast(@spid as varchar)
exec(@sql)
Sometimes, the logged-in user will be locked, which can be unlocked by the following predictions
alter login sa enable;
alter login sa with password ='Cmdi1002';
go