MS SQL query to display complete table name and the number of rows in each table


Below is an SQL query to list the complete table name and the number of rows in each table in the database. This query will be helpful if you are in the support role in your company and to monitor the table growth.

This query will be usefull when you do performance monitoring especially if you are supporting sharepoint or BizTalk server.
Both sharepoint and BizTalk have got data bottleneck.

Normally this type of query will be created as a job in the SQL server and will be scheduled to run everyday to know how table grows in the database.


SELECT sysobj.name as [Table Name] , MAX(sysidx.rows) as [Row Count]
FROM sysobjects sysobj, sysindexes sysidx
WHERE sysobj.xtype = 'U'AND sysidx.id = OBJECT_ID(sysobj.name)
GROUP BY sysobj.name
ORDER BY 1


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: