Looking for something specific?
  Home
Home
Articles
Page Tag-Cloud
  Software
Software Tag-Cloud
Building from Source
Open Source Definition
All Software
  Popular Tags
Legacy
C Plus Plus
Source Code
Class
Cryptography
  Members
Login
Web-Email
Notable Members
  Official
Our Company
Copyright Information
Software EULA
GPL EULA
LGPL Eula
Pre-Release EULA
Privacy Policy
  Support
Make Contact
 
 
Get Table Row Counts
There are many ways to go about determining the count of rows in each table in a database. Including cursors and brute force row counts - but from what I understand there is only one way to get the row count efficiently - and that's to use the table's indexes.

SELECT
	SysO.name AS [Table],
	MAX(SysI.[rows]) AS [Rows]
FROM
	sys.objects As SysO
INNER JOIN sysindexes AS SysI
	ON SysI.id = SysO.object_id
WHERE
	SysO.type = 'u'
GROUP BY
	SysO.name


Is this code snippet, product or advice warrantied against ill-effect and/or technical malaise? No. No it's not! Not expressed - Not implied - not at all.



Tags:
 Index    Maintenance    Snippet    SQL Server  

Created by Josh Patterson on 2/9/2013, last modified by Josh Patterson on 2/9/2013

No comments currently exists for this page. Why don't you add one?
First Previous Next Last 

 
Copyright © 2024 NetworkDLS.
All rights reserved.
 
Privacy Policy | Our Company | Contact