Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9124027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:28:47+00:00 2026-06-17T06:28:47+00:00

How to render all records from all tables in the sample database, below query

  • 0

How to render all records from all tables in the sample database, below query is returning all the tables record counts. but i want all records from all tables in the sample database.

SELECT   TableName = o.name,
         Rows = max(i.rows)
FROM     sysobjects o
         INNER JOIN sysindexes i
           ON o.id = i.id
GROUP BY o.name
ORDER BY Rows DESC
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:28:48+00:00Added an answer on June 17, 2026 at 6:28 am

    You can use an undocumented(*) stored procedure to run a query against each table in the database:

    exec sp_MSforeachtable 'select * from ?'
    

    This will return one result set for each table. If you want the table name as a separate column:

    exec sp_MSforeachtable 'select ''?'' as TableName,* from ?'
    

    There’s no easy way to get just a single result set since, in general, the columns of all of the tables in a database will not be compatible with each other.


    (*) Hopefully, the danger here is obvious. It’s undocumented, so it’s possible that it will go away or change based on any servicing operations applied to SQL Server. On the other hand, I doubt they will ever remove it, and it doesn’t have any special magic inside. For belt and braces, you might want to copy the procedure into your own database under a different name, and then you can rely on it not being changed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i make a SQL query from actionscript? and render all the results
I am retrieving 10 rown from my database but I want to skip the
I'm trying to render all component presentations from the broker database with a certain
Afternoon all, Using the code below I'm trying to load what is render by
My database has records per SKU, giving product options (id's actually, but for clarity
I have a query that seems to be returning the wrong data from the
I thus far used YUI Datatable to render all my records... Since Jquery is
I have an ASP page which will query records from a DB Table and
I render all my surfaces to a buffer, then at the end of the
How can I force FOSUserBundle to render all its pages as a part of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.