Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database

Record Count of Tables in SQL Server

5.00/5 (2 votes)
26 Aug 2010CPOL 5.9K  
Also use either this one:SELECT OBJECT_NAME(SYSINDEXES.id), SYSINDEXES.rowcntFROM SYSINDEXES INNER JOIN SYSOBJECTS ON SYSINDEXES.id = SYSOBJECTS.idWHERE SYSINDEXES.indid < 2 AND SYSOBJECTS.xtype = 'U'or this one:SELECT OBJECT_NAME(id),rowcnt FROM SYSINDEXES WHERE...
SQL
Also use either this one:
SELECT OBJECT_NAME(SYSINDEXES.id), SYSINDEXES.rowcnt
FROM SYSINDEXES INNER JOIN SYSOBJECTS ON SYSINDEXES.id = SYSOBJECTS.id
WHERE SYSINDEXES.indid < 2 AND SYSOBJECTS.xtype = 'U'
<br>
or this one:
SELECT OBJECT_NAME(id),rowcnt FROM SYSINDEXES WHERE OBJECTPROPERTY(id,'IsUserTable')=1 AND indid<2

</br>

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)