SQL:
USE [test] -- 只需修改这里的库名
SELECT a.name table_name, -- 表名
a.crdate crdate, -- 建表时间
b.rows rows, -- 总行数
8*b.reserved/1024 reserved, -- 保留大小(MB)
rtrim(8*b.dpages/1024) used, -- 已使用大小(MB)
8*(b.reserved-b.dpages)/1024 unused -- 未使用大小(MB)
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 a.name,b.rows DESC;
案例:
SQL:
USE [test] -- 只需修改这里的库名
SELECT A.NAME ,B.ROWS,crdate
FROM sysobjects A JOIN sysindexes B ON A.id = B.id
WHERE A.xtype = 'U' AND B.indid IN(0,1)
ORDER BY B.ROWS DESC
案例:
SQL:
USE [test] -- 只需修改这里的库名
select name,crdate from sysobjects where xtype = 'U'
案例:
SQL:
select object_name(id) tablename,
8*reserved/1024 reserved,
rtrim(8*dpages/1024)+'Mb' used,
8*(reserved-dpages)/1024 unused,
8*dpages/1024-rows/1024*minlen/1024 free,
rows ,
t.create_date,
t.modify_date
from sysindexes,sys.tables as t
where object_name(id) = 'test1'
案例:
SQL:
exec sp_spaceused;
案例:
SQL:
EXEC sp_spaceused 'test1'; -- 只需修改表名即可
案例:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)