Chủ Nhật, 18 tháng 5, 2014

SQL SERVER – Find Row Count in Table – Find Largest Table in Database

SQL SERVER – Find Row Count in Table – Find Largest Table in Database

How many rows are there in any particular table?
This script will gives row number for every table in database.

USE AdventureWorks
GO
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
GO


Share This!


Không có nhận xét nào:

Đăng nhận xét