Wednesday, September 19, 2012

Get Number of tables in a database in SQL Server


Here is the query to find total number of tables in a specific database in SQL Server.

USE DBName

SELECT COUNT(*) FROM information_schema.tables WHERE table_type = 'BASE TABLE'



OR

SELECT COUNT(*) FROM sysobjects WHERE xtype = 'U'

DBName is the name of your database in which you want to find the total number of tables.

No comments:

Post a Comment