Knowledge Base Article
Article Type: How To
Product: Other
Product Version:
Component:
Device Brands:
Created: 3-Jan-2013 10:49:44 AM
Last Updated:

How to find the size of tables in SQL

In SQL Management Studio, enter the following. (This returns the size of database.)

EXEC sp_spaceused

Create a table.

CREATE TABLE mytablename
(
    [name] NVARCHAR(128),
    [rows] CHAR(11),
    reserved VARCHAR(18),
    data VARCHAR(18),
    index_size VARCHAR(18),
    unused VARCHAR(18)
)
INSERT mytablename6 EXEC sp_msForEachTable 'EXEC sp_spaceused ''?'''

Run this on the server to get the text file:

dbupdater "select * from mytablename" > mytablename.txt

Average rating:
Please log in to rate.
Rated by 0, Viewed by 3806