sp_spaceused is a system stored procedure that reveals the amount of space used. This procedure can take many different parameters as input in order to show the amount of space on disk that is used. If your system can afford it, it is best to update the usage stats before finding the space used. This ensures accurate results from sp_spaceused.
The most common usage for sp_spaceused is to determine the amount of spaced used for a database. In order to perform this, execute the procedure with no parameters
Below we see that the results for sp_spaceused returns two result sets. The first result set shows a high level view of the database space. With the most important being database size, showing the amount of disk space used for both the data and log files.
The second result set shows the allocation within the database and does not include the log file usage. The total amount is shown under “reserved”. And the Data, Index, and unused spaces are split up to give a good breakdown of what is utilizing the most space.
In order to run this command for a table pass in the table name with schema name enclosed in single quotes.
EXEC sp_spaceused 'SalesLT.Address'
Evaluating this output looks similar to the second record set returned by the database results, except we also get the number of rows contained in the table. This number of rows may not be precisely correct because it gets the number by looking at the table statistics instead of doing an actual count of the rows.