SQLServer如何查看数据库中表占用的磁盘空间(转)

  1. CREATE TABLE tb_SpaceInfoTable
  2. (
  3. ID int identity(1,1),
  4. name sysname,
  5. rows char(11),
  6. reserved varchar(18),
  7. data varchar(18),
  8. index_size varchar(18),
  9. unused varchar(18)
  10. )
  11. GO
  12. EXEC SP_MSFOREACHTABLE
  13. @COMMAND1 = 'INSERT INTO tb_SpaceInfoTable(name,
  14. rows,
  15. reserved,
  16. data,
  17. index_size,
  18. unused)
  19. EXEC SP_SPACEUSED ''?'''
  20. GO
  21. SELECT * FROM tb_SpaceInfoTable
  22. GO

from http://gsky.iteye.com/blog/238582

posted on 2011-07-04 13:27  LongSky  阅读(375)  评论(0编辑  收藏  举报

导航