﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by George Varkey  / Search All Stored Procedures in a Database / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 05:18:35 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Search All Stored Procedures in a Database</title><link>http://www.sqlservercentral.com/Forums/Topic636889-1343-1.aspx</link><description>One suggestion is to add the [b]upper [/b] to both side of the comparision to make it work with case senstive databases.Ex: where upper(text) like upper(@searchstring)</description><pubDate>Fri, 04 Jan 2013 10:27:49 GMT</pubDate><dc:creator>Sri Kondeti-293259</dc:creator></item><item><title>RE: Search All Stored Procedures in a Database</title><link>http://www.sqlservercentral.com/Forums/Topic636889-1343-1.aspx</link><description>I added a quick option to George's original block to specify the DB you want to search. This way it can sit in Master and be called from anywhere on the server. But this split at character 4000 in syscomments is an eye opener. Means this solution isn't complete, even for searching procs only.Ken[code="sql"]ALTER proc [dbo].[SearchObjects] 	@database varchar(100),	@searchString varchar(100)As	Declare @Sql nvarchar(1000)	Set @Sql = 'SELECT Distinct SO.Name	FROM ' + @database + '.dbo.' + 'sysobjects SO (NOLOCK) ' +		'INNER JOIN ' + @database + '.dbo.' + 'syscomments SC (NOLOCK) on SO.Id = SC.ID ' +		'AND SO.Type = ''P'' AND SC.Text LIKE ''%' + @searchString + '%'' ORDER BY SO.Name'	Exec sp_executesql @Sql[/code]</description><pubDate>Wed, 02 Jun 2010 13:36:28 GMT</pubDate><dc:creator>ken.trock</dc:creator></item><item><title>RE: Search All Stored Procedures in a Database</title><link>http://www.sqlservercentral.com/Forums/Topic636889-1343-1.aspx</link><description>Assuming this post belongs to SQL server 2005, you can use the below query to return all SP in the databaseSELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE'</description><pubDate>Wed, 30 Sep 2009 03:34:12 GMT</pubDate><dc:creator>Abhijit More</dc:creator></item><item><title>RE: Search All Stored Procedures in a Database</title><link>http://www.sqlservercentral.com/Forums/Topic636889-1343-1.aspx</link><description>A slight correction :). Having looked at this further it seems that the INFORMATION_SCHEMA.ROUTINES view does not split the procedure definition over more than 1 row it in fact only shows the first 4000 characters of any stored proc. Which actually makes using this view for searching the procedure definitinion less than useful.Oh, and the INFORMATION_SCHEMA views are only in 2005 and above.For 2005 and above the take a look at the OBJECT_DEFINITION function, mentinoed in the following article on the same subject:[url]http://databases.aspfaq.com/database/how-do-i-find-a-stored-procedure-containing-text.html[/url]</description><pubDate>Thu, 29 Jan 2009 02:28:21 GMT</pubDate><dc:creator>nigel.</dc:creator></item><item><title>RE: Search All Stored Procedures in a Database</title><link>http://www.sqlservercentral.com/Forums/Topic636889-1343-1.aspx</link><description>This still suffers from the same problem, in that the ROUTINE_DEFINITION column is only 4000 characters long. Any stored proc longer than 4000 characters in length is split over two rows and any text that spans this 'split' in the definition will not be found by your method. See the link posted earlier.</description><pubDate>Thu, 29 Jan 2009 02:14:38 GMT</pubDate><dc:creator>nigel.</dc:creator></item><item><title>RE: Search All Stored Procedures in a Database</title><link>http://www.sqlservercentral.com/Forums/Topic636889-1343-1.aspx</link><description>I use the following piece of code for a while now and with great success:SELECT ROUTINE_NAME, ROUTINE_DEFINITION ROUTINE_TYPE FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINITION LIKE '%text%' AND ROUTINE_TYPE = 'PROCEDURE'http://databases.aspfaq.com/database/how-do-i-find-a-stored-procedure-containing-text.html</description><pubDate>Wed, 28 Jan 2009 16:40:21 GMT</pubDate><dc:creator>hila</dc:creator></item><item><title>RE: Search All Stored Procedures in a Database</title><link>http://www.sqlservercentral.com/Forums/Topic636889-1343-1.aspx</link><description>Unfortunately this doesn't quite work, see the explanation in the following article:[url]http://www.sqlservercentral.com/articles/Stored+Procedure/62975/[/url]</description><pubDate>Tue, 27 Jan 2009 04:22:06 GMT</pubDate><dc:creator>nigel.</dc:creator></item><item><title>Search All Stored Procedures in a Database</title><link>http://www.sqlservercentral.com/Forums/Topic636889-1343-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/Stored+Procedure/65557/"&gt;Search All Stored Procedures in a Database&lt;/A&gt;[/B]</description><pubDate>Thu, 15 Jan 2009 01:43:31 GMT</pubDate><dc:creator>George Damien Varkey</dc:creator></item></channel></rss>