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 2008 Forums
 Transact-SQL (2008)
 want table names and its rowcounts

Author  Topic 

gsrinivas.
Yak Posting Veteran

56 Posts

Posted - 2009-12-11 : 02:10:56
hello all,
what is the query (not t-sql) for " table names and its rowcounts"
in sql server 2000.

please help.
-GSrinivas.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-12-11 : 02:40:12
EXEC sp_msforeachtable 'SELECT ''?'', COUNT(*) AS Records FROM ?'


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-12-11 : 02:40:24
Try this..

http://senthilnagore.blogspot.com/2009/07/getting-total-row-count-of-table.html

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-12-11 : 02:43:58
quote:
Originally posted by Peso

EXEC sp_msforeachtable 'SELECT ''?'', COUNT(*) AS Records FROM ?'


N 56°04'39.26"
E 12°55'05.63"




Whether sp_msforeachtable is work on sql server 2000???

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-11 : 04:12:50
quote:
Originally posted by senthil_nagore

quote:
Originally posted by Peso

EXEC sp_msforeachtable 'SELECT ''?'', COUNT(*) AS Records FROM ?'


N 56°04'39.26"
E 12°55'05.63"




Whether sp_msforeachtable is work on sql server 2000???

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/



Why not?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-12-11 : 04:32:22
I thought it works for 2005 and later.. Thanks Madhi

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-11 : 04:38:17
quote:
Originally posted by senthil_nagore

I thought it works for 2005 and later.. Thanks Madhi

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/



It is working in all the current versions
But note that it is undocumented and can be removed in future version without notice

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-12-11 : 04:40:43
quote:
Originally posted by senthil_nagore

Try this..

http://senthilnagore.blogspot.com/2009/07/getting-total-row-count-of-table.html

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/



You need to run this in advance to get correct counts

DBCC UPDATEUSAGE ('database_name','table_name') WITH COUNT_ROWS

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

gsrinivas.
Yak Posting Veteran

56 Posts

Posted - 2009-12-14 : 02:47:14
thank you very much guys.

i will try it.
-GSrinivas
Go to Top of Page
   

- Advertisement -