30 January,2010 by Tom Collins
Sometimes there is a requirement to report on total sql row count of all tables. Useful code to gather the SQL row count of all SQL Server tables in a database. The process could be quicker quicker if you reindex prior to executing this code.
This query is dependant on views with SQL Server 2000 backward compatability.
SELECT SCHEMA_NAME(t1.schema_id) AS [schema], t1.name AS [table], i1.rows AS [row_count] FROM sys.tables AS t1 INNER JOIN sys.sysindexes AS i1 ON t1.object_id = i1.id AND i1.indid < 2
SQL Server Disable Indexes and Rebuild Indexes dynamically
SQL Index Fragmentation and sys.dm_db_index_physical_stats
SQL Server sp_updatestats and UPDATE STATISTICS
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |