infolink

Friday, March 26, 2010

SQL Server - Get Row Count in Table TSQL

I was working on a shared site machine over at Ektron Hosting and hating this MyLittleSQLAdmin utility they have, doesn't even give row counts like SQL management studio.

So I needed a quick way to get total row counts on my table, this worked just fine:

USE [OURTABLEHERE]
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

No comments:

Post a Comment

Amazon1