How to unlock a table locked in SQL Server database?
In SQL Server, tables can be unlocked using the following methods:
- In SQL Server Management Studio, you can manually unlock a table by executing the following command.
ALTER TABLE table_name SET (LOCK_ESCALATION = DISABLE)
- Restarting the SQL Server service can also unlock the table, but this will result in all running transactions and connections being disrupted.
- By using the KILL command, you can terminate the session that is currently using the table, thus unlocking the table. For example, execute the following command:
KILL <session_id>
Please make sure you understand the reason for table locking before performing the above operations and handle with caution to avoid data loss or any other issues.