我运行以下查询:
a. select * from TABLE_TEMP
查询成功执行但不返回任何行.返回的数据集为空并包含0行.
可以从以下位置下载此查询的执行计划:
Execution Plan Query a
b. select count(*) from TABLE_TEMP
此查询也成功执行,但它返回一些有限值
可以从以下位置下载此查询的执行计划:
Execution Plan Query b
你能给我任何解决这个问题的指示.
截图PFB:
最佳答案 您可能在数据库中遭受某种腐败.熟悉
the documentation之后运行DBCC CHECKDB(或DBCC CHECKTABLE).特别是关于数据库兼容性级别的索引检查部分和:
In earlier versions of SQL Server, the values for the per-table and per-index row count and page counts can become incorrect. Under certain circumstances, one or more of these values might even become negative. In SQL Server 2005 and later, these values are always maintained correctly. Therefore, databases that are created on SQL Server 2005 and later should never contain incorrect counts; however, databases that are upgraded to SQL Server 2005 and later might.