常用MSSQL语句:每个表大小,某个表所有列

1 返回每个表大小信息

   create table tmp (name varchar(50),rows int,reserved varchar(50),
   data varchar(50),index_size varchar(50),unused varchar(50))
   insert into tmp (name,rows,reserved,
   data,index_size,unused) exec sp_msforeachTable @Command1="sp_spaceused '?'"--sp_spaceused 't_vehicle'
   select * from tmp order by data desc
   drop table tmp

2 获取某个表的所有列信息

   select * from syscolumns where id in (select id from sysobjects where name='ceforst')

posted on 2008-12-31 10:54  广思  阅读(268)  评论(0编辑  收藏  举报

导航