Gets a procedure containing text
2007-10-02 (first published: 2002-06-20)
15,452 reads
Gets a procedure containing text
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Usp_GetProcByText]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[Usp_GetProcByText] GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS OFF GO CREATE PROCEDURE Usp_GetProcByText ( @inText varchar(255) = ' ' ) AS Select @inText = '%' + @inText + '%' Select object_name(id) from syscomments where patindex (@intext,text)>0 IF @@RowCount = 0 Begin Print '**************************************** No Procedures found contining text ***************************************' End Else Begin Print '********************************************************* Done ********************************************************' End GO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO