Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to get all tables_name,count of record from a database?

Example:-I am looking for something like

1)SELECT COUNT(*),Table_name from Sys.tables

2)SELECT COUNT(*),Tbl_Employee FROM Tbl_Employee
Posted

SELECT OBJECT_NAME(id),max(rows) FROM sys.sysindexes group by id

Right
But in my opinion perfect answer should be:-

SQL
SELECT OBJECT_NAME(id),max(rows) FROM sys.sysindexes
WHERE OBJECT_SCHEMA_NAME(id)<>'sys'
group by id order by OBJECT_NAME(id) ASC
 
Share this answer
 
v2
C#
select coulumnName,count(*) from sys.sysindexes
 
Share this answer
 
SELECT OBJECT_NAME(id),rows FROM sys.sysindexes
 
Share this answer
 
Comments
StackQ 20-Dec-13 12:34pm    
thnx for help, your query almost helped me in a right way, but plz first check from ur side, is it perfectly appropriate. Becoz in practical even u don't want to write a query where there are some additional recoreds like --sysrscols
sysrowsets
sysrowsets
sysrowsets
sysclones

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900