Unlocking Method for SQL Server Database Tables Locked

Use [database name].

Begin
--Query locked tables and session IDs
Select
Request_Session_Id as spid
OBJECT_Name (resource-associated_entity_id) as tableName
From
Sys. dm_Tran_Locks Where
Resource_Type=' OBJECT'
--End the process of locking the table
Declare @Spid int, @Sqlstr varchar (1000)
Set @Spid; The spid found above
Set @Sqlstr=' Kill+ Cast ( @spid as varchar (50))
Exec ( @sqlstr)
End.