Count the number of tables in database

Ranjeet_8
Posted by Ranjeet_8 under Sql Server category on | Points: 40 | Views : 1013

Use Your_DataBase_Name;
SELECT COUNT(*) FROM sys.tables;

Using Schema Name :

SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'dbo'; // dbo is schema name.

Comments or Responses

Posted by: Srilu.Nayini577 on: 8/14/2012 Level:Starter | Status: [Member] | Points: 10

Method1:
-----------
Use databaseName;

SELECT COUNT(*) from INFORMATION_SCHEMA.TABLES



Method2:
-----------

SELECT COUNT(*) from information_schema.tables
WHERE table_type = 'base table'

Method3:
------------
select count(*) from sysobjects where xtype = 'U'

Login to post response