Query to list number of records in each table in a database

0 votes
Oct 11, 2019 in Database by Daric
• 500 points
1,444 views

1 answer to this question.

0 votes

Use the below code to list number of records in from the table

SELECT T.name AS [TABLE NAME], I.rows AS [ROWCOUNT] 
    FROM   sys.tables AS T 
       INNER JOIN sys.sysindexes AS I ON T.object_id = I.id 
       AND I.indid < 2 
ORDER  BY I.rows DESC
answered Oct 11, 2019 by Omaiz
• 560 points

Related Questions In Database

0 votes
2 answers

What are the ways to get the count of records in a table

With the help of the SQL count ...READ MORE

answered Aug 20, 2020 in Database by Okugbe
• 280 points
3,997 views
0 votes
1 answer

What do ‘Record’, ‘Field’ and ‘Table’ mean in terms of a database?

You can refer to the following definitions ...READ MORE

answered Nov 12, 2018 in Database by Sahiti
• 6,370 points
22,047 views
0 votes
1 answer

How to load data of .csv file in MySQL Database Table?

At first, put the dataset in the ...READ MORE

answered Jul 5, 2019 in Database by Reshma
1,425 views
0 votes
1 answer

How to rename a column in a database table using SQL?

For SQL Server, use sp_rename USE AdventureWorks; GO EXEC sp_rename 'Customers.CustomerTerritory.TerritoryID', ...READ MORE

answered Feb 9, 2022 in Database by Neha
• 9,020 points
762 views
0 votes
0 answers

SQL to find the number of distinct values in a column

In a column, I can choose each ...READ MORE

Aug 15, 2022 in Database by Kithuzzz
• 38,000 points
894 views
0 votes
0 answers

How to find sum of multiple columns in a table in SQL Server 2005?

I have a table Emp which has these rows: Emp_cd ...READ MORE

Aug 19, 2022 in Database by Kithuzzz
• 38,000 points
1,621 views
0 votes
0 answers

Find the number of columns in a table

If a table's number of rows and ...READ MORE

Aug 20, 2022 in Database by Kithuzzz
• 38,000 points
348 views
0 votes
0 answers

Get all table names of a particular database by SQL query?

I'm developing a program that can interact ...READ MORE

Aug 22, 2022 in Database by Kithuzzz
• 38,000 points
485 views
0 votes
2 answers

How to select the nth row in a SQL database table?

SELECT * FROM ( SELECT ID, NAME, ROW_NUMBER() ...READ MORE

answered Apr 23, 2020 in Database by anand
• 140 points
26,294 views
0 votes
1 answer

Which is the Preferred Method of Storing Passwords In Database?

Generally, we can use the sha hash ...READ MORE

answered Oct 11, 2019 in Database by Omaiz
• 560 points
1,083 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP