Share via


SqlMethodAttribute.IsMutator Property

Definition

Indicates whether a method on a user-defined type (UDT) is a mutator.

public:
 property bool IsMutator { bool get(); void set(bool value); };
public bool IsMutator { get; set; }
member this.IsMutator : bool with get, set
Public Property IsMutator As Boolean

Property Value

true if the method is a mutator; otherwise false.

Remarks

If the IsMutator property is set to true and the return type of the method is void, SQL Server marks the method as a mutator. A mutator method is one that causes a state change in the UDT instance. Mutator methods can be called in assignment statements or data modification statements, but cannot be used in queries. If a method is marked as a mutator but does not return void, then CREATE TYPE does not fail with an error. Even though a returned value other than void does not raise an error, the returned value is not accessible and cannot be used.

The default value of the IsMutator property is false.

A property can be a mutator if SqlMethodAttribute is used on the setter and IsMutator is set to true. However, a property setter is implicitly treated as a mutator, so it is not necessary to set the IsMutator property of the SqlMethodAttribute to true.

Applies to