Question : The SQL Server cannot obtain a LOCK resource at this time

Can someone help explain this error I am getting:

"The SQL Server cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users or ask the system administrator to check the SQL Server lock and memory configuration."

And how I can fix it :)

Answer : The SQL Server cannot obtain a LOCK resource at this time

I'll try. :)  Relational database systems have a variety of "locking" mechanisms to enforce some forms of data integrity. A simple example is when two people try to update the same data at the same time. There has to be some way to determine which change goes first and second. One way it has to do this is to put a "lock" on a table (or page of data in the table, or a single row) as soon as the first request starts, so that a second or third request to change data isn't honored until the first lock is released.

Such things can lead to problems like the one you're encountering. Another kind is a "deadlock", where two people try to update two tables at the same time: person A tries to update first table A then table B as part of a single "transaction" while person B tries to update first table B, then table A. Person A's request gets a lock on table A while person B's request gets a lock on table B. But person A's request can't finish and release it's lock on table A until it can update table B, and person B's request can't finish and release it's lock on table B until it can update table A. In these circumstances, SQL Server chooses one of the processes to kill and be rolled back.

Your specific problem could have any of several causes, as outlined in BOL. For us to help you troubleshoot it, we need more information, such as:

1. What did you do that returned the error message? If it was running a query or stored procedure, post the code.
2. What is the structure of the tables involved? (table names, column names, and datatypes)
3. How many rows of data are in each of these tables?
4. What indexes exist on these tables? (if any)
5. How much memory does your SQL Server computer have?
Random Solutions  
 
programming4us programming4us