Tuesday, 3 July 2007

A nifty SQL query for searching for text references

I needed to find out where i was loading a file in a bulk insert today and found the following query:

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%search string goes here%'
AND ROUTINE_TYPE='PROCEDURE'

That will basically do a find for you and list the procedures your search string is present in.
Very handy.

No comments: