How to get space acquired by a table in SQL Server?


SQL Server provide a system defined stored procedure “sp_spaceused” which is used to get the number of rows, disk space reserved, and disk space used by a table.
Syntax: sp_spaceused Table_Name
Example:

Create table Temp
(
  ID  int identity(1,1) ,
  EmployeeName varchar(100),
  Age int
) 
Insert into Temp(EmployeeName,Age)
Select 'Hitesh',25 union
Select 'Priyanka',23 union
Select 'Dev',33 union
Select 'Neha',25 union
Select 'Abhimanyu',22 union
Select 'Bhawesh',30

sp_spaceused Temp


Result:
Data
8KB