Technical Article

Usp_GetProcByText

,

Getobject containing pattern

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

Rate

3 (2)

You rated this post out of 5. Change rating

Share

Share

Rate

3 (2)

You rated this post out of 5. Change rating