Table without lock won't query unless nolock hint included

妖精的绣舞 提交于 2019-12-23 02:38:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!