几段查看数据库表占用硬盘空间的tsql

create table tablesize (name varchar(50),rows int,reserved varchar(50),
  data varchar(50),index_size varchar(50),unused varchar(50))
insert into tablesize (name,rows,reserved,
  data,index_size,unused) exec sp_msforeachTable @Command1="sp_spaceused '?'"
 
update tablesize set data=replace(data,'KB','')
 
select *,convert(int,data) as a from tablesize order by A desc 
 
drop table tablesize


DELETE FROM LocalCopyOf_vw_PoitemValues



EXEC SP_SPACEUSED





SELECT * FROM 
[Master].[dbo].[SYSPROCESSES] WHERE [DBID] 
IN 
(
  SELECT 
   [DBID]
  FROM 
   [Master].[dbo].[SYSDATABASES] 
  WHERE 
   NAME='Ligentix4_1'
)

 

posted @ 2015-04-08 13:07  黄铨  阅读(215)  评论(0编辑  收藏  举报