4

我运行以下查询:

a. select * from TABLE_TEMP

查询成功执行,但未返回任何行。返回的数据集为空,包含 0 行。这个查询的执行计划可以从: Execution Plan Query a

b. select count(*) from TABLE_TEMP

此查询也成功执行,但它返回一些有限值此查询的执行计划可以从以下位置下载: 执行计划查询 b

你能给我任何解决这个问题的建议吗?

PFB截图: 奇怪的行为

4

2 回答 2

3

You might be suffering from some sort of corruption in your database. Run DBCC CHECKDB (or DBCC CHECKTABLE) after familiarising yourself with the documentation. In particular, the section on index checking with respect to database compatibility levels and:

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.

于 2012-04-09T22:30:58.123 回答
-1

Count 是 SQL 中的函数,它返回 Int 值,即受影响的记录数。

于 2012-04-09T08:55:07.017 回答