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
 General SQL Server Forums
 New to SQL Server Programming
 Row No

Author  Topic 

sanjay5219
Posting Yak Master

240 Posts

Posted - 2010-09-01 : 08:39:58
Hi All,

is there any query by which we can know that which table is haveing how many rows

please suggest

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-09-01 : 08:43:28
http://beyondrelational.com/blogs/madhivanan/archive/2007/11/02/different-ways-to-count-rows-from-a-table.aspx

Madhivanan

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

sanjay5219
Posting Yak Master

240 Posts

Posted - 2010-09-01 : 08:49:45
i want to check all table in one shot.
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2010-09-01 : 08:51:28
if sql server 2005 are high

Exec sp_MsForEachTable 'select ''?'' as table_name,count(1) as no_of_rows from ?'


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 - 2010-09-01 : 08:51:33
select object_name(id) as table_name, rows from sysindexes where indid<2


Madhivanan

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

sanjay5219
Posting Yak Master

240 Posts

Posted - 2010-09-01 : 09:18:45
Thanks Madhivanan
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-09-02 : 04:15:39
quote:
Originally posted by sanjay5219

Thanks Madhivanan


You are welcome

Madhivanan

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

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-09-02 : 04:16:42
quote:
Originally posted by senthil_nagore

if sql server 2005 are high

Exec sp_MsForEachTable 'select ''?'' as table_name,count(1) as no_of_rows from ?'


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

http://senthilnagore.blogspot.com/



It will work in all versions. But beware that it is undocumented and will be removed from future versions

Madhivanan

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

- Advertisement -