UserDefinedFunction Class

The UserDefinedFunction object represents a SQL Server user-defined function.

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

Syntax

'Declaration
<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None Or AutomatedPolicyEvaluationMode.Enforce Or AutomatedPolicyEvaluationMode.CheckOnChanges Or AutomatedPolicyEvaluationMode.CheckOnSchedule)> _
<StateChangeEventAttribute("CREATE_FUNCTION", "FUNCTION")> _
<StateChangeEventAttribute("ALTER_FUNCTION", "FUNCTION")> _
<PhysicalFacetAttribute(PhysicalFacetOptions.ReadOnly)> _
<StateChangeEventAttribute("RENAME", "FUNCTION")> _
Public NotInheritable Class UserDefinedFunction _
    Inherits ScriptSchemaObjectBase _
    Implements ICreatable, IAlterable, IRenamable, IDroppable,  _
    IExtendedProperties, IScriptable, ITextObject, IColumnPermission, IObjectPermission
'Usage
Dim instance As UserDefinedFunction
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None|AutomatedPolicyEvaluationMode.Enforce|AutomatedPolicyEvaluationMode.CheckOnChanges|AutomatedPolicyEvaluationMode.CheckOnSchedule)]
[StateChangeEventAttribute("CREATE_FUNCTION", "FUNCTION")]
[StateChangeEventAttribute("ALTER_FUNCTION", "FUNCTION")]
[PhysicalFacetAttribute(PhysicalFacetOptions.ReadOnly)]
[StateChangeEventAttribute("RENAME", "FUNCTION")]
public sealed class UserDefinedFunction : ScriptSchemaObjectBase, 
    ICreatable, IAlterable, IRenamable, IDroppable, IExtendedProperties, 
    IScriptable, ITextObject, IColumnPermission, IObjectPermission
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode::None|AutomatedPolicyEvaluationMode::Enforce|AutomatedPolicyEvaluationMode::CheckOnChanges|AutomatedPolicyEvaluationMode::CheckOnSchedule)]
[StateChangeEventAttribute(L"CREATE_FUNCTION", L"FUNCTION")]
[StateChangeEventAttribute(L"ALTER_FUNCTION", L"FUNCTION")]
[PhysicalFacetAttribute(PhysicalFacetOptions::ReadOnly)]
[StateChangeEventAttribute(L"RENAME", L"FUNCTION")]
public ref class UserDefinedFunction sealed : public ScriptSchemaObjectBase, 
    ICreatable, IAlterable, IRenamable, IDroppable, IExtendedProperties, 
    IScriptable, ITextObject, IColumnPermission, IObjectPermission
[<SealedAttribute>]
[<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.None|AutomatedPolicyEvaluationMode.Enforce|AutomatedPolicyEvaluationMode.CheckOnChanges|AutomatedPolicyEvaluationMode.CheckOnSchedule)>]
[<StateChangeEventAttribute("CREATE_FUNCTION", "FUNCTION")>]
[<StateChangeEventAttribute("ALTER_FUNCTION", "FUNCTION")>]
[<PhysicalFacetAttribute(PhysicalFacetOptions.ReadOnly)>]
[<StateChangeEventAttribute("RENAME", "FUNCTION")>]
type UserDefinedFunction =  
    class
        inherit ScriptSchemaObjectBase
        interface ICreatable
        interface IAlterable
        interface IRenamable
        interface IDroppable
        interface IExtendedProperties
        interface IScriptable
        interface ITextObject
        interface IColumnPermission
        interface IObjectPermission
    end
public final class UserDefinedFunction extends ScriptSchemaObjectBase implements ICreatable, IAlterable, IRenamable, IDroppable, IExtendedProperties, IScriptable, ITextObject, IColumnPermission, IObjectPermission

Remarks

The UserDefinedFunction object provides functionality that allows users to programmatically manage functions.

To get UserDefinedFunction object properties, users can be a member of the public fixed server role.

To set UserDefinedFunction object properties, users must have ALTER permission on the user-defined function.

To create a user-defined function, users must have CREATE FUNCTION permission on the database and ALTER permission on the specified schema.

To drop a user-defined function, users must have CONTROL permission on the user-defined function and ALTER permission on the specified schema.

To grant, deny, or revoke permissions on the user-defined function to other users, users must have CONTROL permission on the user-defined function.

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.