Click here to Skip to main content
15,884,298 members
Articles / Database Development / SQL Server

Find particular word or text from the entire stored procedure

Rate me:
Please Sign up or sign in to vote.
4.22/5 (9 votes)
22 May 2011CPOL 41.7K   7  

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
26 Jan 2012tarun_j200
SELECT OBJECT_NAME(object_id), definition FROM sys.sql_modules WHERE definition LIKE '%GetEmployee%'
Please Sign up or sign in to vote.
16 Feb 20131Lam
Create the following table on a local database:CREATE TABLE [dbo].[TB_TEMP_TABLESTORE]( [SEARCH_STRING] [nvarchar](128) NULL, [DB_NAME] [nvarchar](128) NULL, [OBJECT_NAME] [nvarchar](128) NULL, [OBJECT_TYPE] [nvarchar](50) NULL) ON [PRIMARY]Rename Yourdatabase to the same...
Please Sign up or sign in to vote.
26 Apr 2011NGO Quang Minh
You can create a simple stored procedure like that:DECLARE @StringToSearch varchar(100)SET @StringToSearch = 'GetEmployee'SET @StringToSearch = '%' +@StringToSearch + '%'SELECT Distinct SO.NameFROM sysobjects SO (NOLOCK) INNER JOIN syscomments SC (NOLOCK) on SO.Id = SC.ID AND...
Please Sign up or sign in to vote.
26 Jan 2012CaldasGSM
since syscomments is nvarchar(4000) the word may be split into several rows.. so you concat them.. or at least pair them up... here is the sp I use to search on the stored proceduresCREATE PROCEDURE [dbo].[sp_FindInProc] @sText NVARCHAR(MAX) = '%'ASBEGIN SET NOCOUNT ON ...
Please Sign up or sign in to vote.
26 Jan 2012ednrg
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](...

License

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


Written By
Technical Lead Infostretch Ahmedabad-Gujarat
India India
Aspiring for a challenging carrier wherein I can learn, grow, expand and share my existing knowledge in meaningful and coherent way.

sunaSaRa Imdadhusen


AWARDS:

  1. 2nd Best Mobile Article of January 2015
  2. 3rd Best Web Dev Article of May 2014
  3. 2nd Best Asp.Net article of MAY 2011
  4. 1st Best Asp.Net article of SEP 2010


Read More Articles...

Comments and Discussions