Count Tables, Views and Stored Procedures in you Database

sql server
I posted some useful scripts to count your database’s Tables, Views and Stored Procedures.

Count Tables

[sourcecode language=’sql’]
SELECT COUNT(*) AS ‘Tables Count’ FROM sys.objects WHERE TYPE =’U’ AND name NOT LIKE ‘Sy%’
SELECT name AS ‘Tables Name’ FROM sys.objects WHERE TYPE =’U’ AND name NOT LIKE ‘Sy%’
[/sourcecode]

Count Views

[sourcecode language=’sql’]SELECT COUNT(*) AS ‘Views Count’ FROM sys.objects WHERE TYPE =’V’ AND name NOT LIKE ‘Sy%’
SELECT name AS ‘View Name’ FROM sys.objects WHERE TYPE =’V’ AND name NOT LIKE ‘Sy%’
[/sourcecode]

Count Stored Procedures

[sourcecode language=’sql’]
SELECT COUNT(*) AS ‘Stored Procs Count’ FROM sys.objects WHERE TYPE =’P’ AND name NOT LIKE ‘Sy%’
SELECT name AS ‘Stored Procs Name’ FROM sys.objects WHERE TYPE =’P’ AND name NOT LIKE ‘Sy%’
[/sourcecode]

Posted in Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *