Sometime we need to count the total numbers of reord count in a database or in a table... given below is the query.
use windmail
go
SELECT tblname.name AS "Table Name", recordcount.rowcnt AS "Row Count"
FROM sysobjects tblname, sysindexes recordcount
WHERE recordcount.id = tblname.id
AND indid IN(0,1)
AND xtype = 'u'
AND tblname.name <> 'sysdiagrams'
ORDER BY recordcount.rowcnt DESC
COMPUTE SUM(recordcount.rowcnt);
GO
No comments:
Post a Comment