Site icon Sibeesh Passion

Get the Count of Entries in Each Table in a DB in SQL

Hi All,

This code will helps you to get the count of entries in each table in a DB in SQL:
[sql]
SELECT
sysobjects.Name
, sysindexes.Rows
FROM
sysobjects
INNER JOIN sysindexes
ON sysobjects.id = sysindexes.id
WHERE
type = ‘U’
AND sysindexes.IndId < 2
ORDER BY
sysobjects.Name
[/sql]
OR
[/sql]
SELECT
sum(sysindexes.Rows),GETDATE()
FROM
sysobjects
INNER JOIN sysindexes
ON sysobjects.id = sysindexes.id
WHERE
type = ‘U’
AND sysindexes.IndId < 2 [/sql] Kindest Regards

Exit mobile version