How to Count Total Number of Stored Procedure and Tables in SQL Server 2008

Count total number of tables 
 
Suppose you want to count the number of tables in a database. It's quiet simple. Just use the information_schema.tables
The below query will return you the count of the tables in the database .
 
USE YOURDBNAME
select count(*) as TablesCount from sys.tables
 
Count total number of stored procedure

USE YOURDBNAME 
select count(*) as ProceduresCount from sys.procedures
 
Count total number of  triggers

USE YOURDBNAME 
SELECT count(*) AS MyTriggers FROM sys.triggers
 
Count total number of tables  views

USE YOURDBNAME 
SELECT count(*) AS MyViews FROM sys.views
Ebook Download
View all
Learn
View all