How to Clear a Record Lock in SQL
- 1). Open the SQL Server Enterprise Server console. This is found on the Start menu of Windows under the "SQL Server" menu. Click "SQL Server Management Studio" to open the console.
- 2). Type "sp_who 'active' " in the workspace, and press the "Enter" key. This lists all the processes and the usernames and session IDs associated with them. You need to identify which ID is causing the lock.
- 3). Identify the session ID for the record lock. From the list propagated in Step 2, find the user who has the record lock and take note of the session ID. This ID will be needed for the following steps.
- 4). Type "Kill <session ID>" in the console. This will remove the record lock on the table row. After the record lock is removed from the table, open the table to ensure that the lock was indeed removed.
- 5). Stop and restart the application that had the problem querying the table. This step is required if the record lock was causing problems with a desktop application. This also helps reset any application that was having errors when trying to query the locked record.
Source...