Pearl
Pearl

Reputation: 534

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.

Upvotes: 7

Views: 19437

Answers (6)

JItendriya Sendha
JItendriya Sendha

Reputation: 31

SELECT * FROM DB_Name.INFORMATION_SCHEMA.TABLES

Upvotes: 1

Arpit
Arpit

Reputation: 6260

SELECT * FROM user_objects  
WHERE object_name LIKE 'proc%' ....

Upvotes: 1

gmhk
gmhk

Reputation: 15960

SELECT     * FROM   sysobjects  WHERE     (xtype = 'p')

You can get all the information from sysobjects

Upvotes: 0

Ash Burlaczenko
Ash Burlaczenko

Reputation: 25465

Simply

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

Hope this helps.

Upvotes: 2

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174369

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

Upvotes: 2

CristiC
CristiC

Reputation: 22698

select count(*) 
from DatabaseName.information_schema.routines 
where routine_type in ('PROCEDURE', 'FUNCTION', 'TABLE')

Upvotes: 6

Related Questions