获得所有表的表记录,和使用空间的SQL

来源:互联网 发布:软件安装管理器2016 编辑:程序博客网 时间:2024/05/02 00:33
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 id drop table ##'

出来非常帅的报表


0 0
原创粉丝点击