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 2005 Forums
 Transact-SQL (2005)
 Find that which table of database have records

Author  Topic 

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2007-12-18 : 04:27:46
Hi

I want to know that which table of my DataBase have records(rows).
My database have 200 tables and i do't want to open and check each tables i am using SQL server 2000.


Ranjeet Kumar Singh

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2007-12-18 : 04:39:17
[code]
Select Object_Name(id),* From Sys.Sysindexes Where [Rows] <=0
[/code]

Chirag

http://www.chirikworld.com
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-18 : 04:42:32
A quick way

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

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-18 : 04:44:16
quote:
Originally posted by chiragkhabaria


Select Object_Name(id),* From Sys.Sysindexes Where [Rows] <=0


Chirag

http://www.chirikworld.com


Why did you use [rows]<=0?

Madhivanan

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

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2007-12-18 : 04:46:59
OP told that he want the table name which has no records ..

Chirag

http://www.chirikworld.com
Go to Top of Page

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2007-12-18 : 04:49:46
Thanks........

Ranjeet Kumar Singh
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-18 : 04:50:59
quote:
Originally posted by ranjeetsingh_6

Hi

I want to know that which table of my DataBase have records(rows).
My database have 200 tables and i do't want to open and check each tables i am using SQL server 2000.


Ranjeet Kumar Singh



Madhivanan

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

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2007-12-18 : 04:53:50
opps.. I guess it was my perception since, i thought OP wants to drop the rest of the tables..

Chirag

http://www.chirikworld.com
Go to Top of Page
   

- Advertisement -