Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: Friday, October 9, 2015 2:50 PM
Points: 14, Visits: 83
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-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 12:07 PM
Points: 40,772, Visits: 38,020
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."

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: Wednesday, September 30, 2015 10:05 PM
Points: 273, Visits: 60
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