Friday, July 14, 2017

SQL Server - sp_search_code

Hi,

the following stored procedure from the stone-age of sql server 7.0 is very helpful when searching for the usage of objects inside database code (up till now).

http://vyaskn.tripod.com/code/search_stored_procedure_code.txt
"Copyright © 1997 - 2002 Narayana Vyas Kondreddi. All rights reserved."



It queries the syscomments table so I would simplify the query to something like

   select * from syscomments c 
   where c.text like '%<TEXTTOCHECK>%' 

... but of course the check for encryption and object properties for filtering makes absolutely sense when you are allowed to deploy such a maintenance stored procedure.