之前一直在sybase12.5下使用如下的命令查看表空间的占用, 升级到15后该命令使用时报错"reserved_pgs"和"rowcnt"已经变化,根据提示换成"reserved_pages"和"row_count"但是依然提示错误 "Function ROW_COUNT invoked with wrong number or type of argument(s). "
哪位高手能帮忙看看错在哪里了? 是不是15版本的结构变了此命令不行了?
盼高手指导! 多谢多谢!
select 'table' = o.name,
'size (KB)' = convert(int,sum(reserved_pgs(o.id,i.doampg) +
reserved_pgs(o.id,i.ioampg)
) *
2
),
'# rows' = convert(int,sum(rowcnt(i.doampg)))
from sysobjects o,
sysindexes i
where o.id = i.id
and o.type = 'U'
group by o.name
order by 2 desc
指820134这个值大于smallint类型的范围,smallint的范围应该是0~2^15-1
而为什么会定义成smallint类型,我也不明白了...只能为你解答这么多
原因是reserved_pages函数,第一个参数是dbid,所以要改成
reserved_pages(db_id(), o.id,i.doampg)