Execute the below query to find the table names and the row
count of the corresponding tables in a database.
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
The row count of a particular table can be found by
executing
exec sp_spaceused 'tablename'
No comments:
Post a Comment