Home

spaceused

Spaceused refers to the SQL Server system stored procedure sp_spaceused, a tool for reporting how space is used within a database or a specific table. It is commonly used by database administrators to monitor growth, plan storage, and identify large objects that may affect performance or capacity.

When run without parameters, sp_spaceused returns database-level information, including database_name, database_size, and unallocated_space. When a table

Typical syntax:

- EXEC sp_spaceused;

- EXEC sp_spaceused 'dbo.YourTable';

- EXEC sp_spaceused @updateusage = 'TRUE';

Output interpretation:

- For a database: database_size indicates total allocated space, while unallocated_space shows free space within the database

- For a table: rows is the row count; reserved is total space allocated to the object; data

Permissions:

- Executing sp_spaceused generally requires membership in the db_owner fixed database role or equivalent permissions on the

Notes:

- The procedure provides quick, practical insights but its numbers are estimates and can change with automated

or
object
name
is
supplied
as
@objname,
the
procedure
returns
object-level
statistics
such
as
name,
rows,
reserved,
data,
index_size,
and
unused.
The
values
for
size-related
columns
are
typically
reported
in
kilobytes.
An
optional
parameter
@updateusage
can
be
set
to
'TRUE'
to
force
SQL
Server
to
refresh
the
space
usage
data
before
returning
results.
files.
is
space
used
by
data;
index_size
is
space
used
by
indexes;
unused
is
reserved
but
not
yet
used
space.
database.
growth,
autogrowth
events,
and
index
maintenance.
For
deeper
analysis,
it
is
often
used
alongside
dynamic
management
views
and
other
monitoring
tools.