Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Get record count for every table in a DB (1 Step) Expand / Collapse
Author
Message
Posted Saturday, September 22, 2007 1:07 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, May 21, 2014 7:55 AM
Points: 14, Visits: 82
Comments posted to this topic are about the item Get record count for every table in a DB (1 Step)
Post #401458
Posted Thursday, November 29, 2007 8:03 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, November 29, 2007 7:58 AM
Points: 1, Visits: 0
cool...

SELECT o.name TableName ,i.rows TblRowCount
FROM sysobjects o
INNER JOIN sysindexes i ON (o.id = i.id)
WHERE o.xtype = 'u'
AND i.indid < 2
order by TblRowCount desc
Post #427490
Posted Thursday, November 29, 2007 9:41 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 12:00 AM
Points: 35,547, Visits: 32,137
Better think about DBCC UPDATEUSAGE once in a while....

--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #427909
Posted Monday, January 26, 2009 9:57 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, April 19, 2012 6:44 AM
Points: 273, Visits: 56
Below is the best in sql2005

SELECT object_name(object_id) 'Table_Name', SUM(row_count) 'Total_Rows'
FROM sys.dm_db_partition_stats where index_id <2 GROUP BY object_name(object_id)
ORDER BY object_name(object_id)



Comments please....

Srihari Nandamuri
Post #643544
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse