Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find stored procedure by name

Is there any way I can find in SQL Server Management Studio stored procedure by name or by part of the name? (on active database context)

Thanks for help

like image 277
gruber Avatar asked Aug 26 '10 10:08

gruber


People also ask

How do I find a stored procedure?

You can find the stored procedure in the Object Explorer, under Programmability > Stored Procedures as shown in the following picture: Sometimes, you need to click the Refresh button to manually update the database objects in the Object Explorer.

How do I find the SP name in SQL Server?

In the Object Explorer in SQL Server Management Studio, go to the database and expand it. Expand the Programmability folder. Right Click the Stored Procedures folder. From the right-click menu, select Filter in the right-click menu.

How do you find where a stored procedure is being used in SQL Server?

Using SQL Server Management Studio Expand Databases, expand the database in which the procedure belongs, and then expand Programmability. Expand Stored Procedures, right-click the procedure and then click View Dependencies. View the list of objects that depend on the procedure.


2 Answers

You can use:

select *  from     sys.procedures  where     name like '%name_of_proc%' 

if you need the code you can look in the syscomments table

select text  from      syscomments c     inner join sys.procedures p on p.object_id = c.object_id where      p.name like '%name_of_proc%' 

Edit Update:

you can can also use the ansi standard version

SELECT *  FROM      INFORMATION_SCHEMA.ROUTINES  WHERE      ROUTINE_NAME LIKE '%name_of_proc%' 
like image 152
Preet Sangha Avatar answered Sep 29 '22 17:09

Preet Sangha


Assuming you're in the Object Explorer Details (F7) showing the list of Stored Procedures, click the Filters button and enter the name (or partial name).

alt text

like image 37
Codesleuth Avatar answered Sep 29 '22 16:09

Codesleuth