Count total number of tables, views| stored procedures or functions in Sql database.

You can use this queries..
-- Count Number Of Tables In A Database
select 'Tables',Count(*) [Count] from sys.tables
  Union ALL
-- Count Number Of Tables In A Database
SELECT 'Procedures',COUNT(*)  AS [Count] FROM 
sys.procedures
  Union ALL
-- Count Number Of Views In A Database
SELECT 'Triggers',COUNT(*) AS [Count] FROM sys.triggers
  Union ALL
-- Count Number Of Views In A Database
SELECT 'Views',COUNT(*) AS [Count] FROM  sys.views
Result:

Post a Comment

0 Comments