Thursday, April 15, 2010

Find Row Count in Table – Find Largest Table in Database – T-SQL

This script inform the number of rows are existing in the table. This script will gives row numbers for every tables in same database.

SELECT OBJECT_NAME(OBJECT_ID) TableName, st.row_count
FROM sys.dm_db_partition_stats st
WHERE index_id < 2
ORDER BY st.row_count DESC

No comments:

Post a Comment