SQL 2005 - Search stored procedures for text (Not all text is being searched)

Posted by hamlin11 on Stack Overflow See other posts from Stack Overflow or by hamlin11
Published on 2009-08-02T01:13:51Z Indexed on 2010/04/21 5:53 UTC
Read the original article Hit count: 230

The following bits of code do not seem to be searching the entire routine definition.

Code block 1:

select top 50 * from information_schema.routines
where routine_definition like '%09/01/2008%' and specific_Name like '%NET'

Code Block 2:

SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES 
WHERE ROUTINE_DEFINITION LIKE '%EffectiveDate%' AND ROUTINE_TYPE='PROCEDURE' and ROUTINE_NAME like '%NET'

I know for a fact that these bits of SQL work under most circumstances. The problem is this: When I run this for "EffectiveDate" which is buried at line ~800 in a few stored procedures, these stored procedures never show up in the results. It's as if "like" only searches so deep.

Any tips on fixing this?

I want to search the ENTIRE stored procedure for the specified text.

Thanks!

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server