Discussion ForumCategory: QuestionsSQL Query to find Table Size in Bytes
1 Answers
vinod palne Staff answered 1 year ago
 

Here is the query that will find Table Size in Bytes

SELECT CASE WHEN (GROUPING(SOB.NAME)=1) THEN ‘AllTables’
ELSE ISNULL(SOB.NAME, ‘unknown’) END AS TableName,
SUM(SYS.LENGTH) AS ByteLength
FROM SYSOBJECTS SOB, SYSCOLUMNS SYS
WHERE SOB.xTYPE=’u’ AND SYS.ID=SOB.ID
GROUP BY SOB.NAME
WITH CUBE