views:

107

answers:

1

Is there way to use the "Find in Files" command for searching all of the stored procedures and views for a particular database in SQL Server 2005 Management Studio?

Edit

I want to search all of the stored procedures in database X for string Y.

+2  A: 

You can't.

You can however use a query, for exemple:

SELECT ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE = 'PROCEDURE'
AND ROUTINE_DEFINITION LIKE '%searchstring%'

This will however not work for CLR or encrypted stored procedures.

Kevin
Thanks. That is the exact command I was looking for.
Michael Kniskern
I was looking for this, too, thanks! Would it be churlish of me to suggest SQL Server Management Studio should have a command which does this?
Ian Grainger