Printed 2017/08/21 06:28AM

sp_spaceused system-stored procedure

By Basit Aalishan Masood-Al-Farooq, 2013/01/02

You can use the sp_spaceused system-stored procedure to return space usage information about a database or a table within a database. The syntax for this procedure is:

sp_spaceused [@objectname=['objectname']]

You use the objectname parameter to enter the name of a table, indexed view, or Service Broker queue to retrieve space usage information specific to that object. If you set the updateusage to TRUE, DBCC UPDATEUSAGE updates usage information. The default value for this parameter is FALSE.

You can run the command without any parameters to retrieve information about the current database:


This returns the following information:

To view information for a table in the current database, you must include the table name. For example, to look at information for the Person.Address table in the AdventureWorks2012 database, you would run:

sp_spaceused 'Person.Address'

This would return:

It is not necessary to include the parameter names (@parametername =) when running this command.

Copyright © 2002-2017 Redgate. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.