Friday, January 28, 2011

Table Row Count Easily in Sql server 2000/@005

Sql Server 2000
SELECT o.NAME, i.rowcnt FROM sysindexes AS i INNER JOIN sysobjects AS o ON = WHERE i.indid < 2 AND OBJECTPROPERTY(, 'IsMSShipped') = 0 ORDER BY o.NAME

Sql Server 2005
SELECT, ddps.row_count FROM sys.indexes AS i INNER JOIN sys.objects AS o ON i.OBJECT_ID = o.OBJECT_ID INNER JOIN sys.dm_db_partition_stats AS ddps ON i.OBJECT_ID = ddps.OBJECT_ID AND i.index_id = ddps.index_id WHERE i.index_id < 2 AND o.is_ms_shipped = 0 ORDER BY o.NAME

No comments:

Post a Comment