Gokul's Blog

Get the Rowcount of All Tables in a Database SQL Server

Leave a comment

Method-1:

SELECT sysobjects.Name AS TableName, sysindexes.Rows as Rows
FROM
    sysobjects
    INNER JOIN sysindexes
    ON sysobjects.id = sysindexes.id
WHERE
    type = ‘U’
    AND sysindexes.IndId < 2
ORDER BY
    sysobjects.Name

 

Method-2:

select convert(varchar(30),object_name(id)) [Table Name], rows from sysindexes
where object_name(id) not like ‘sys%’ and indid = 1
order by object_name(id)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s