问题
Microsoft SQL Server 2008 R2
I have a table that currently can not be queried on but seems to not have a lock against it.
Doesn't return:
SELECT * FROM myTable
Does return:
SELECT * FROM myTable with (nolock)
Inserts into the table also fail.
When I run sp_lock
, I don't find any instances of locks on myTable
. When I run the "Resource Locking Statistics by Object" report, I don't see any locks for myTable
.
What other possibilities could there be that would keep a table from being acted upon?
Thanks.
回答1:
Run sp_who2 and look at all the spids. See if you still have a connection to the database that is still thinking your performing an insert/update/delete to the table. If you find it, kill the spid and you should be able to query the table.
来源:https://stackoverflow.com/questions/31054823/table-without-lock-wont-query-unless-nolock-hint-included