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

Leave a Reply

Your email address will not be published. Required fields are marked *

Serverless 360