Author : Guest
Total Views : 185
Posted On : Fri, May 4, 2018
Updated On : Fri, May 4, 2018

Find byte size of all tables in SQL SERVER

In this article, we will see that how we can get the byte size of all the tables in SQL Server database.

SELECT CASE 
			WHEN (GROUPING(SO.name)=1) 
				THEN 'All_Tables'
			ELSE 
				ISNULL(SO.name, 'unknown') 
			END AS Table_name,
SUM(sys.length) AS Byte_Length
FROM SYSOBJECTS SO, SYSCOLUMNS sys
WHERE SO.xtype='u' AND sys.id=SO.id
GROUP BY SO.name
WITH CUBE