SQL Server 查看表占用空间
代码
exec sp_MSForeachTable
@precommand=N' create table ##( table_name sysname, records int, save_space Nvarchar(10), use_space varchar(10), index_space varchar(10), free_space varchar(10))', @command1=N'insert ## exec sp_spaceused ''?''', @postcommand=N'select top 10 * from ## order by use_space desc drop table ##'