CFLib.org – Common Function Library Project

cfStoredProcSearch(datasource, searchstring)

Last updated November 14, 2007

author

Jose Diaz

Version: 1 | Requires: CF6 | Library: DatabaseLib

Description:
Returns a list of stored procedures containing the string supplied.

Return Values:
Returns a query of stored procedure names that match.

Example:

<cfinclude template="cfStoredProcSearch.cfm">

<cfset qresult = cfStoredProcSearch("Your_Datasource_Name","String_TO_Search")>

<cfoutput query="qResult">
	<font face="verdana" size="2">#qresult.name#</font><br/><br/>
</cfoutput>

Parameters:

Name Description Required
datasource Database to search. Yes
searchstring Name to search for. Yes

Full UDF Source:

<!---
 Search SQL Server Stored Procedures for a value.
 
 @param datasource 	 Database to search. (Required)
 @param searchstring 	 Name to search for. (Required)
 @return Returns a query of stored procedure names that match. 
 @author Jose Diaz (bleachedbug@gmail.com) 
 @version 1, November 14, 2007 
--->
<cffunction name="cfStoredProcSearch" access="public" returntype="query" output=false>

	<cfargument name="datasource" type="string" required="true"/>
	<cfargument name="searchString" type="string" required="true"/>
	<cfset var qStoredProcSearch = "">

	<cfquery name="qStoredProcSearch" datasource="#arguments.datasource#">
		select name
		from sysobjects s
		   , syscomments c
		where s.id = c.id and text like '%#arguments.searchString#%'
	</cfquery>


	<cfreturn qStoredProcSearch />

</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson