FunctionExists
Updated: 30 October 2008
Use wct.FunctionExists to determine if the specified function exists in the database.
Syntax
SELECT [westclintech].[wct].[FunctionExists](
<@Schema, nvarchar(4000),>
<@FunctionName, nvarchar(4000),>)
Arguments
@Schema
is the name of schema containing the function to test for. @Schema is an expression of the character string data type category.
@FunctionName
is the name of function being tested for on the database. @FunctionName is an expression of the character string data type category.
Return Types
bit
Remarks
· FunctionExists simplifies SQL intended to drop an application role if it exists.
Example
IF (wct.FunctionExists('wct','myFunction') <> 0) DROP FUNCTION wct.myFunction
Here is the result set
----------------------
Command(s) completed successfully