Tuesday, October 18, 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 

0 comments to “TSQL Get Count of All Records in All Tables”

Post a Comment

 

Computer Info Copyright © 2016 -- Powered by Blogger