Remove-UserDefinedFunction

Removes a user-defined function.

Syntax

Remove-UserDefinedFunction [-Name] <String> [[-SchemaName] <String>] [<CommonParameters>]

Description

Removes a user-defined function. Will throw an exception and rollback the migration if the user-defined function doesn't exist.

By default, the user-defined function is assumed to be in the dbo schema. Use the Schema parameter to specify a different schema.

You can conditionally delete a user-defined function only if it exists using the IfExists switch.

Parameters

Name Type Description Required? Pipeline Input Default Value
Name String

The name of the user-defined function to remove/delete.

true false
SchemaName String

The schema of the user-defined function. Default is dbo.

false false dbo

EXAMPLE 1

Remove-UserDefinedFunction -Name MyFunc

Removes the dbo.MyFunc user-defined function.

EXAMPLE 2

Remove-UserDefinedFunction -Name MyFunc -SchemaName rivet

Removes the rivet.MyFunc user-defined function.