Click here to Skip to main content
15,883,603 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to find all the stored procedures refering to the database in the code inside. Please help.

What I have tried:

SELECT Name
FROM sys.procedures
WHERE object_definition(OBJECT_ID) LIKE '%anything%'
Posted
Updated 13-Feb-17 23:38pm
Comments
Karthik_Mahalingam 7-Feb-17 2:21am    
the query works fine.
dirtyshooter 7-Feb-17 2:30am    
It works but not for my requirement.
dirtyshooter 7-Feb-17 2:42am    
correct karthik. My bad.
Karthik_Mahalingam 7-Feb-17 3:00am    
cool
Richard Deeming 9-Feb-17 6:57am    
RedGate's SQL Search[^] is free, and pretty good at searching for strings in database objects.

try this.


select distinct OBJECT_NAME(ID) FROM SYSCOMMENTS WHERE TEXT LIKE '%code%'
 
Share this answer
 
select * from YourDatabaseName.information_schema.routines
where routine_type = 'PROCEDURE'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900