Finding All Stored Procedures and Functions in a database

Here is a basic query you can use to find All the Stored Procedures, Functions, and Views within your database. This is very usefully for several reasons.

Let us say you were assigned to a project another DBA or a developer created and maintained the stored procedures, functions, or views.

Type Initial(s)        Type Of Object Returned
FN      SQL Scalar Function
IF      Inline Table Valued Function
P      SQL Stored Procedure
PC      CLR Stored Procedure
TF      SQL Table Valued Function
V      View
X      Extended Stored Procedure

USE [your_database_name_here];
GO

SELECT * FROM sys.all_objects
WHERE ([type] = ‘P’ OR [type] = ‘X’ OR [type] = ‘PC’)
ORDER BY [name];
GO

Hope this helps.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s