How to find space used by table in SQL Server

Use ‘sp_spaceused’ to find space used by table in SQL Server.

Following is a syntax for that.
sp_spaceused  N’YourTableName’

=> Permission to execute sp_spaceused is granted to the public role.

Displaying disk space information about a table

The following example reports disk space information for the Vendor table and its indexes.

USE AdventureWorks2012;
GO
EXEC sp_spaceused N'Purchasing.Vendor';
GO

  Displaying updated space information about a database

The following example summarizes space used in the current database and uses the optional parameter @updateusage to ensure current values are returned.

 Only members of the db_owner fixed database role can specify the @updateusage parameter.
USE AdventureWorks008R2;
GO
EXEC sp_spaceused @updateusage = N'TRUE';
GO
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s