Developping for the translation industry RSS 2.0



 Wednesday, 02 July 2008

This isn’t necessary a critical part of a DBA’s job but, at times, it can be useful to have an idea of how many rows are in your databases.

The simplest way to get it is with this query:

select sum(rowcnt) from sysobjects, sysindexes
where sysindexes.id = sysobjects.id and sysindexes.indid in (0, 1) and sysobjects.xtype = 'u'

This will get you the sum of rows in the entire database, for users objects only.  If you want the table-by-table breakdown, you can simply add the name of the object in the query:

select sysobjects.name, sysindexes.rowcnt from sysobjects, sysindexes
where sysindexes.id = sysobjects.id and sysindexes.indid in (0, 1) and sysobjects.xtype = 'u'
order by sysobjects.name

Wednesday, 02 July 2008 09:43:51 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Code Snippet | SQL

Navigation
Advertisement
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2018
Stanislas Biron
Sign In
Statistics
Total Posts: 135
This Year: 0
This Month: 0
This Week: 0
Comments: 1
All Content © 2018, Stanislas Biron