본문 바로가기

DB

[MSSQL 2000] 테이블 사이즈 및 그룹보기



SELECT
	(SELECT NAME FROM SYSOBJECTS WHERE XTYPE = 'U' AND ID = A.ID) AS 테이블명
	,ROWCNT
	,B.GROUPNAME
	,CAST(RESERVED*8/1024. AS DECIMAL(15,3)) AS [테이블사이즈(MB)]
FROM	SYSINDEXES A WITH (NOLOCK)
INNER JOIN SYSFILEGROUPS B WITH (NOLOCK)
	ON A.GROUPID=B.GROUPID
WHERE	A.ID IN (SELECT ID FROM SYSOBJECTS WHERE XTYPE = 'U')
	AND A.INDID IN(0,1)
ORDER BY
	GROUPNAME
	,TBL_SIZE DESC