Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Count of rows from User Defined tables

Author  Topic 

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 2006-03-09 : 10:10:39
Guys,

Is there any system table where count of all the rows from the user defined tables in the database.

I am expecting an output something like this

NAME COUNT
______________________
EMPLOYEE 20000
DEPARTMENT 30000

Thanks

JoeNak
Constraint Violating Yak Guru

292 Posts

Posted - 2006-03-09 : 10:15:58
Someone asked this just the other day...
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=62909
Go to Top of Page

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-03-09 : 11:11:38
I got the following answer for the same issue some time back

DBCC UPDATEUSAGE ('MYDB_Name')

SELECT o.[name], i.rowcnt
FROM sysobjects o
LEFT OUTER JOIN sysindexes i
ON o.[id] = i.[id]
WHERE o.xtype = 'U' AND i.indid < 2
ORDER BY o.[name]
Go to Top of Page
   

- Advertisement -