Table Size (Rows and Bytes)
A query that reports row counts and data size in GB for every user table in the current database.
A quick size report for every user table in the current database: row count, column count and reserved data size in gigabytes (from the base index's partition stats), sorted largest first. A fast way to see where your data actually lives.
SELECT
(select name from sys.databases where database_id = db_id()) as [Database],
schema_name(o.schema_id) as [Schema],
o.name as [Table],
ddps.row_count as [Rows],
(SELECT COUNT(0) FROM sys.columns as c WHERE c.object_id = o.object_id) as [Columns],
Cast((ddps.reserved_page_count * 8192) / 1024 / 1024 / 1024.0 as Decimal(16, 2)) as [DataSizeGB]
FROM
sys.indexes AS i
INNER JOIN sys.objects AS o
ON i.OBJECT_ID = o.OBJECT_ID
INNER JOIN sys.dm_db_partition_stats AS ddps
ON i.OBJECT_ID = ddps.OBJECT_ID
AND i.index_id = ddps.index_id
WHERE
i.index_id < 2 AND o.is_ms_shipped = 0
ORDER BY
ddps.reserved_page_count desc