Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home SQL Server Count Total Rows For All Tables In MS SQL Server

Count Total Rows For All Tables In MS SQL Server

This SQL script below will count and display list of table name along with total rows for all tables in a specified MS SQL Server Database.

Instead of using:

SELECT COUNT(*) FROM TABLE_NAME

… for each table in the database, we can query the system tables as below:

SELECT sysobjects.Name AS TableName, sysindexes.ROWS AS TotalRows
FROM 	sysobjects 
		INNER JOIN sysindexes ON sysobjects.id = sysindexes.id
WHERE TYPE = 'U' AND sysindexes.IndId < 2
ORDER BY sysindexes.ROWS DESC

An example from Umbraco database

Example Total Rows For All Tables In MS SQL Server Database

Example Total Rows For All Tables In MS SQL Server Database

Sep 28, 2012 Hoan Huynh
Magnanimous Magento – Why it is so popular!Check Free Disk Space On Linux
You Might Also Like:
  • Where Are ASPStateTempApplications and ASPStateTempSessions Tables?
  • How To Track Website With Multiple Google Analytisc Accounts
  • Facebook Like Button And Recommend Button With fb:like, iframe and html5
  • Create Count Down Download Page With JavaScript
  • JQuery Create Textbox With Count Down Limit Characters
  • PHP Get Facebook URL Total Comments, Total Likes, Total Shares
  • ASP.NET Store Session In MS SQL Server Database
  • Free Web Admin For Microsoft SQL Server And Oracle – 1ClickDBPro
  • Export/Import Data From Local Database To Remote Database With MS SQL Server 2008
  • Consider SQL Server Express 2008 Limitations
  • yprestashop

    The article is written in a very good manner.

Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at hoan@4rapiddev.com

5 years ago SQL Serversysindexes, sysobjects, Umbraco302
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
14,334 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
10,295 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
10,279 views
JQuery Allow only numeric characters or only alphabet characters in textbox
8,990 views
Firefox Can Not Connect To Proxy Server
Fix Can Not Connect To Proxy Server In Firefox, Google Chrome And Internet Explorer
5,869 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Magento Fatal error: Unsupported operand types
  • Ionic bower the name contains uppercase letters
  • PHP Magento Get Manufacturer Name And ID From Magento Product ID
  • Know Simple Hacks To Systematize Media Library in WordPress
  • A handy guideline on adding custom menu item in WordPress admin
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (26)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (140)
EMAIL SUBSCRIPTION

Sign up for our newsletter to receive the latest news and event postings.

Recommended
  • CDN
  • Hosting
  • Premium Themes
  • VPS
2014 © 4 Rapid Development