Focus on WEB Application and Software Engineering
八月 23
这组SQL语句可以得到如下图的结果,超赞!

$uncut$
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 ##'

原址:http://www.xland.cn/article/74/36/0603/9142.htm
SQL Server未公开的两个存储过程:
http://fineboy.cnblogs.com/archive/2005/09/10/233910.html

当前评分 1.3 , 共有 3 人参与

  • Currently 1.333333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

添加评论


 

看不清?点击图片看看
biuquote
Loading



关于我

kittow (天笑)
80年代生于“天府之国”四川
爱好:编程、篮球、数码、旅游
乘一叶兴趣小舟,漂泊于浩瀚IT海洋。。。
TITLE:MSE of UESTC & 软件设计师
Technical Capacity | Last Blog