Click here to Skip to main content
15,895,746 members
Articles / Database Development / SQL Server
Alternative
Tip/Trick

Find particular word or text from the entire stored procedure

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
26 Jan 2012CPOL 6K  
Not necessarily an alternative, but a wrapper. I created it as a quick stored proc, and put it in the master db, so it can be used in any database.Usage: exec fi 'last_name'.USE [master]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE PROCEDURE [dbo].[fi](...

Not necessarily an alternative, but a wrapper. I created it as a quick stored proc, and put it in the master db, so it can be used in any database.


Usage: exec fi 'last_name'.


SQL
USE [master]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[fi]( @StringToSearch varchar(100) )
AS
BEGIN
 
SET @StringToSearch = '%' +@StringToSearch + '%'
SELECT Distinct SO.Name
FROM sysobjects SO (NOLOCK)
   INNER JOIN syscomments SC (NOLOCK) on SO.Id = SC.ID
   AND SO.Type = 'P'
   AND SC.Text LIKE @StringToSearch
ORDER BY SO.Name

END

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --