SELECT a.name, b.rows
,LTRIM (STR (b.used * 8/(case when b.used<1000 then 1 else 1024 end) , 15, 0)
+ (case when b.used<1000 then ' KB' else ' MB' end)) as [使用空间]
,LTRIM (STR (b.reserved * 8/(case when b.reserved<1000 then 1 else 1024 end), 15, 0)
+ (case when b.reserved<1000 then ' KB' else ' MB' end)) as [分配空间]
FROM sysobjects AS a
INNER JOIN sysindexes AS b ON a.id = b.id
WHERE (a.type = 'u') AND (b.indid IN (0, 1))
ORDER BY b.rows DESC