Created
July 12, 2012 00:11
-
-
Save ryankirkman/3094623 to your computer and use it in GitHub Desktop.
Get the total number of rows in all user tables (Microsoft SQL Server)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Sourced from: http://decipherinfosys.wordpress.com/2007/02/13/counting-number-of-records-for-all-the-tables-sql-server/ | |
-- with only slight modifications | |
SELECT SUM(ind.rows) AS Total_Rows_in_all_user_tables | |
FROM sysobjects AS obj | |
INNER JOIN sysindexes AS ind | |
ON obj.id = ind.id | |
WHERE obj.xtype = 'u' | |
AND ind.indid < 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment