Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find number of stored procedures, tables ,functions present in a Database

How to find number of stored procedures, tables ,functions present in a Database?

Please help me finding the above.

like image 809
Pearl Avatar asked Jun 29 '11 10:06

Pearl


3 Answers

select count(*) 
from DatabaseName.information_schema.routines 
where routine_type in ('PROCEDURE', 'FUNCTION', 'TABLE')
like image 68
CristiC Avatar answered Oct 14 '22 10:10

CristiC


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

like image 39
Daniel Hilgarth Avatar answered Oct 14 '22 11:10

Daniel Hilgarth


Simply

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

Hope this helps.

like image 26
Ash Burlaczenko Avatar answered Oct 14 '22 11:10

Ash Burlaczenko