SQL Flow Field Guide

sys.sp_spaceused

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

spspaceused displays the number of rows, disk space reserved, and disk space used by objects in the database.

What changes

Input
Not stated in the Microsoft summary.
Output or change
Not stated in the Microsoft summary.

Syntax at a glance

sys.sp_spaceused
    [ [ @objname = ] N'objname' ]
    [ , [ @updateusage = ] 'updateusage' ]
    [ , [ @mode = ] 'mode' ]
    [ , [ @oneresultset = ] oneresultset ]
    [ , [ @include_total_xtp_storage = ] include_total_xtp_storage ]
[ ; ]

Work example

spspaceused displays the number of rows, disk space reserved, and disk space used by objects in the database.

Write a proposed call on paper. Name the target, required permission, expected change, and recovery step before any lab use.

Check your work Reports space counters for the current database. This call omits @updateusage, which can run DBCC UPDATEUSAGE and is not read-only.

Practice SQL

Open in SQL Flow

Open the SQL for a walkthrough. Run the example in SQL Server to check its result.

EXEC sys.sp_spaceused;

Open Microsoft Learn for full syntax, permissions, and details for your version.