How to find the number of stored procedures, tables, functions present in the database

How to find the number of stored procedures, tables, functions present in the database?

Please help me find the above.

+6
source share
6 answers
select count(*) from DatabaseName.information_schema.routines where routine_type in ('PROCEDURE', 'FUNCTION', 'TABLE') 
+5
source

You can use sys.Tables for sys.Tables tables for stored procedures and this answer for functions.

+2
source

Simply

 SELECT COUNT(*) FROM sysobjects WHERE xtype IN ('u', 'p', 'fn') 

Hope this helps.

+1
source
 SELECT * FROM user_objects WHERE object_name LIKE 'proc%' .... 
+1
source
 SELECT * FROM DB_Name.INFORMATION_SCHEMA.TABLES 
+1
source
 SELECT * FROM sysobjects WHERE (xtype = 'p') 

You can get all the information from sysobjects

0
source

Source: https://habr.com/ru/post/891626/


All Articles