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>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson