Tuesday, May 24, 2011

how to search texts of stored procedures

Lots of stored procedures on the ms sql
and you're looking for one of wich text contains 'bla'

so here is the query :

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE /*ROUTINE_NAME */ROUTINE_DEFINITION LIKE '% sp_executesql%'
AND ROUTINE_TYPE='PROCEDURE'


here
ROUTINE_NAME: name of stored procedure
ROUTINE_DEFINITION: text of stored procedure

No comments: