Selasa, 18 Oktober 2016

TSQL Get Count of All Records in All Tables

Just a reminder for myself on how to do this in a pinch:
USE   [AdventureWorks2008R2]
GO

SELECT      SCHEMA_NAME(A.schema_id) + . +
            A.Name, SUM(B.rows) AS RowCount
FROM        sys.objects A
INNER JOIN sys.partitions B ON A.object_id = B.object_id
WHERE       A.type = U
GROUP BY    A.schema_id, A.Name
Based on link:
SQL Server – Row count for all views / tables 

lamsim

About lamsim

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :