当前位置: 代码迷 >> Sql Server >> 用sp_spaceused检测表的空间误差解决方法
  详细解决方案

用sp_spaceused检测表的空间误差解决方法

热度:88   发布时间:2016-04-27 18:58:53.0
用sp_spaceused检测表的空间误差
我从ORACLE上导了张很大的表下来,记录数是12393377;
在SQL   SERVER中核对数据,
一开始用的是:sp_spaceused   my_table   检测到ROWS:12393000
而用select   count(*)   from   my_table   显示为:12393377

这是为什么呢?会有这么大误差,我还以为导数出错了,
不明白,就是因为用select   来检测速度慢,才用sp_spaceused的,
怎么办呢?

------解决方案--------------------
sp_spaceused my_table 检测到ROWS是一个估计值,select count(*)是准确值
------解决方案--------------------
select rows from sysindexes
where indid <2 and id=object_id( 'my_table ')

  相关解决方案