首页 > 代码库 > 20170221v8

20170221v8

select schema_name(t.schema_id) as [Schema], t.name as TableName,i.rows as [RowCount]
from sys.tables as t, sysindexes as i
where t.object_id = i.id and i.indid <=1

exec sp_spaceused ‘HYDXD_BARTMC‘ --(查询表所占空间)
exec sp_spaceused ‘表名‘, true --(更新表的空间大小,准确的表空大小)
exec sp_spaceused --(数据库大小查询)
exec sp_MSforeachtable "exec sp_spaceused ‘?‘" --(所有用户表空间表小,SQL统计数据,大量事务操作后可能不准)
exec sp_MSforeachtable "exec sp_spaceused ‘?‘,true" --(所有用户表空间表小,大数据库慎用)

20170221v8