当前位置:首页 > 软件开发 > dev
firefox

获得所有表信息的SQL语句

exec sp_msforeachtable
@precommand=n
create table ##(
id int identity,
表名 sysname,
字段数 int,
记录数 int,
保留空间 nvarchar(10),
使用空间 varchar(10),
索引使用空间 varchar(10),
未用空间 varchar(10)),
@command1=ninsert ##(表名,记录数,保留空间,使用空间,索引使用空间,未用空间) exec sp_spaceused ?
    update ## set 字段数=(select count(*) from syscolumns where id=object_id(?)) where id=scope_identity(),
@postcommand=nselect * from ## order by id drop table ##

 ↓相关文章:
© 2006-2008 All Rights Reserved