Pages

Monday, December 29, 2008

Table Size in SQL Server

SELECT
CASE WHEN (GROUPING(sob.name)=1) THEN 'Total'
ELSE ISNULL(sob.name, 'unknown') END AS 'Table',
SUM(sys.length) AS Byte_Length
FROM sysobjects sob, syscolumns sys
WHERE sob.xtype='u'
AND sys.id=sob.id
GROUP BY sob.name
WITH CUBE

No comments: