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 

Related Post:

0 comments:

Post a Comment

 
Copyright 2009 Information Blog
Powered By Blogger