Tuesday, December 4, 2012

Find instances of a string in all your stored procedures:


This is a great little trick I came across while we were moving from one server to another and had to change the prefix on all references to that SQL machine - but it work in any instance where you need to search through all your stored code:


USE <databasename>;
go
 
SELECT routine_name
              ,routine_definition
FROM information_schema.routines
WHERE routine_definition LIKE '%<my search string>%'
  AND routine_type = 'PROCEDURE'
ORDER BY routine_name;





No comments:

Post a Comment