惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - Rickel

在webView 中使用JS 调用 Android / IOS的函数 Function 数据库镜像的配置 about WBS sql server 2005 压缩实例下所有数据库文件及日志文件 语句 TFS服务器及服务帐号迁域的处理 [西安招聘] 微软西安分公司 招聘.NET软件工程师,MOSS开发工程师 SQL清除数据库日志方法 JavaScript 中的Key 事件区别 ASP.NET URL Rewrite. URL重写 生成高品质的缩略图 Apache Error:(OS 10048)Only one usage of each socket address is normally permitted. 页面响应自定义控件的事件 推荐大家看 《亵渎》 断字处理 break-word I'm Back 部署带Crystal Reports的Web应用程序 - Rickel 用C#读取Excel文件:从指定单元格开始向右向下读取数据 Well-formed AssemblyInfo.cs 毕业一周年纪念
查看SQL Server中某数据库下每个表占用的空间大小
Rickel · 2009-03-03 · via 博客园 - Rickel


if
 not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[tablespaceinfo]'and OBJECTPROPERTY(id, N'IsUserTable'= 1
)
create table tablespaceinfo --创建结果存储表

(nameinfo varchar(50) , 
rowsinfo 
int , reserved varchar(20
) , 
datainfo 
varchar(20
) , 
index_size 
varchar(20
) , 
unused 
varchar(20
) )delete from tablespaceinfo --清空数据表

declare @tablename varchar(255--表名称

declare @cmdsql varchar(500)DECLARE Info_cursor CURSOR FOR 
select
 o.name 
from dbo.sysobjects o where OBJECTPROPERTY(o.id, N'IsTable'= 1
 
and o.name not like N'#%%' order by
 o.nameOPEN Info_cursorFETCH NEXT FROM Info_cursor 
INTO @tablename
 WHILE @@FETCH_STATUS = 0
BEGINif exists (select * from dbo.sysobjects where id = object_id(@tablenameand OBJECTPROPERTY(id, N'IsUserTable'= 1)
execute
 sp_executesql 
N
'insert into tablespaceinfo exec sp_spaceused @tbname'
,
N
'@tbname varchar(255)'
,
@tbname = @tablename
FETCH NEXT FROM Info_cursor 
INTO @tablename
 
END
CLOSE Info_cursor
DEALLOCATE
 Info_cursor
GO
--itlearner注:显示数据库信息
sp_spaceused @updateusage = 'TRUE' --itlearner注:显示表信息
select * 
from
 tablespaceinfo 
order by cast(left(ltrim(rtrim(reserved)) , len(ltrim(rtrim(reserved)))-2as intdesc

Drop tablespaceinfo
转载至:http://hi.baidu.com/lilith_3615/blog/item/d5acb96484ed40f1f7365480.html