HOW TO GET ALL TABLE SIZE

Sunil Soni
Posted by Sunil Soni under Sql Server category on | Points: 40 | Views : 2258
CREATE TABLE #TableSize
(TableName VARCHAR(100),
Records BIGINT,
Reserved VARCHAR(10),
Data VARCHAR(10),
Index_Size VARCHAR(10),
UnUsed VARCHAR(10))
GO
INSERT #TableSize
EXEC('sp_msforeachtable "sp_spaceused ''?''"')
GO
SELECT TableName,Records,Reserved,Data,Index_Size,UnUsed FROM #TableSize
GO
DROP TABLE #TableSize

Comments or Responses

Posted by: T.saravanan on: 9/14/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
Nice info.Kindly post your code inside the code tag.
Posted by: Pervej on: 9/22/2011 Level:Starter | Status: [Member] | Points: 10

Login to post response