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

  • SEARCH
  • Home
  • 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 7710681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:11:12+00:00 2026-06-01T01:11:12+00:00

Maybe you easily said how to I provide table names and row counts? Pseudo

  • 0

Maybe you easily said how to I provide table names and row counts?

Pseudo SQL:

for "select tablename from system.Tables" into :tablename
  execute "select count(*) from ? into ?" using :tablename, :count
  return row(:tablename, :count)
end for

Can you tell me show me this script in T-SQL?

  • 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-01T01:11:13+00:00Added an answer on June 1, 2026 at 1:11 am

    If you’re on SQL Server 2005 or newer (you unfortunately didn’t specify which version of SQL Server you’re using), this query should give you that information:

    SELECT 
        TableName = t.NAME,
        TableSchema = s.Name,
        RowCounts = p.rows
    FROM 
        sys.tables t
    INNER JOIN 
        sys.schemas s ON t.schema_id = s.schema_id
    INNER JOIN      
        sys.indexes i ON t.OBJECT_ID = i.object_id
    INNER JOIN 
        sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id
    WHERE 
        t.is_ms_shipped = 0
    GROUP BY
        t.NAME, s.Name, p.Rows
    ORDER BY 
        s.Name, t.Name
    

    This produces an output something like (this is from AdventureWorks):

    TableName       TableSchema      RowCounts
    AWBuildVersion    dbo                  1
    DatabaseLog       dbo               1597
    ErrorLog          dbo                  0
    Department        HumanResources      16
    Employee          HumanResources     290
    JobCandidate      HumanResources      13
    Address           Person           19614
    AddressType       Person               6
    ... and so on......
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This maybe a stupid question, but as I can not easily undo my change
You can easily use exec() or shell_exec() to execute a system command, like ls
Maybe you all know that .app bundle is easily accessible for reading via such
Is there a way to make a more elegant UI easily? (Maybe something like
Maybe seems little bit strange but I need e-commerce/web shop/cart system for just one
Maybe this is a little tricky .... Someone said that: The count (of an
I need a script (could of course easily write one , but maybe there's
I thought this would be something I could easily google, but maybe I'm not
I know it may be quite easily for you. I have a text which
Maybe this has already been answered and I am searching incorrectly, but here is

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.