Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Get database name, table name and record count

Posted on 2014-11-24
4
104 Views
Last Modified: 2014-11-24
What query can I use to return the database name, table and record count for all the tables in a DB?

Would return  something like this

NORTHWIND       CATEGORIES             100
NORTHWIND      CUSTOMERS               500

etc.. etc..

thx
0
Comment
Question by:JElster
4 Comments
 
LVL 24

Assisted Solution

by:Phillip Burton
Phillip Burton earned 75 total points
ID: 40462447
Right-hand click on your database, and go to Reports - Standard Reports - Disk Usage by Table.
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 350 total points
ID: 40462453
EXEC sys.sp_MSforeachdb 'use ?;SELECT DISTINCT DB_NAME(), OBJECT_NAME(id), rowcnt FROM sys.sysindexes'
0
 
LVL 48

Assisted Solution

by:Vitor Montalvão
Vitor Montalvão earned 75 total points
ID: 40462465
Try this one for each database:
SELECT OBJECT_NAME(id) TableName, rows
FROM sys.sysindexes s
WHERE id > 255 AND indid<=1
ORDER BY 1

Open in new window

0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 40462508
learn something new every day..
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Gettg error - Please help Msg 252, Level 16, State 1, Line 1 3 30
SQL Help 27 57
TSQL recursive CTE challenge... 8 29
partitioning database after decade growth 8 19
There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question