exec sp_MSForEachTable
@precommand=N' 
create table ##(id int identity,表名 sysname,字段数 int,记录数 int,保留空间 Nvarchar(10),使用空间 varchar(10),索引使用空间 varchar(10),未用空间 varchar(10))',
@command1=N'
insert ##(表名,记录数,保留空间,使用空间,索引使用空间,未用空间) exec sp_spaceused ''?'' update ## set 字段数=(select count(*) from syscolumns where id=object_id(''?'')) where id=scope_identity()',
@postcommand=N'
select * from ## order by convert(INT,replace(保留空间,"KB","")) desc 
drop table ##'

  放在要查看的数据库,执行一下查询即可。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2021-09-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2021-11-24
相关资源
相似解决方案