Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Count the number of tables in sql server database

Status
Not open for further replies.

sujitopics

Programmer
Oct 9, 2001
69
KR
Hai

How to count the number of tables existed in database

pl send the sql query to count the number of tables existed in the database in sqlserver 2000 environment

thankyou very much

yours suji
 

Select Count(*) As DBCount
From master.dbo.sysdatabases Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
select count(*) from INFORMATION_SCHEMA.TABLES where table_type='BASE TABLE'

This returns the number of tables in the current database for which the user has permissions.
 

Moonshadow,

Thanks for catching my error. For some reason I read "count databases." :~/ Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top