sqlserver 和oracle有点不同:
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
本文介绍了一种SQL Server中查询表空间使用情况的方法,包括已使用空间、分配空间等详细信息,并提供了具体实现的SQL语句。
1648

被折叠的 条评论
为什么被折叠?



