Trigger-Klasse

The Trigger object represents a SQL Server trigger.

Vererbungshierarchie

System.Object
  Microsoft.SqlServer.Management.Smo.SmoObjectBase
    Microsoft.SqlServer.Management.Smo.SqlSmoObject
      Microsoft.SqlServer.Management.Smo.NamedSmoObject
        Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase
          Microsoft.SqlServer.Management.Smo.Trigger

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

Syntax

'Declaration
<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)> _
<PhysicalFacetAttribute(PhysicalFacetOptions.ReadOnly)> _
Public NotInheritable Class Trigger _
    Inherits ScriptNameObjectBase _
    Implements ICreatable, IAlterable, IDroppable, IMarkForDrop,  _
    IExtendedProperties, IScriptable, ITextObject, ISfcSupportsDesignMode
'Usage
Dim instance As Trigger
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)]
[PhysicalFacetAttribute(PhysicalFacetOptions.ReadOnly)]
public sealed class Trigger : ScriptNameObjectBase, 
    ICreatable, IAlterable, IDroppable, IMarkForDrop, IExtendedProperties, 
    IScriptable, ITextObject, ISfcSupportsDesignMode
[EvaluationModeAttribute(AutomatedPolicyEvaluationMode::CheckOnSchedule)]
[PhysicalFacetAttribute(PhysicalFacetOptions::ReadOnly)]
public ref class Trigger sealed : public ScriptNameObjectBase, 
    ICreatable, IAlterable, IDroppable, IMarkForDrop, IExtendedProperties, 
    IScriptable, ITextObject, ISfcSupportsDesignMode
[<SealedAttribute>]
[<EvaluationModeAttribute(AutomatedPolicyEvaluationMode.CheckOnSchedule)>]
[<PhysicalFacetAttribute(PhysicalFacetOptions.ReadOnly)>]
type Trigger =  
    class 
        inherit ScriptNameObjectBase 
        interface ICreatable 
        interface IAlterable 
        interface IDroppable 
        interface IMarkForDrop 
        interface IExtendedProperties 
        interface IScriptable 
        interface ITextObject 
        interface ISfcSupportsDesignMode 
    end
public final class Trigger extends ScriptNameObjectBase implements ICreatable, IAlterable, IDroppable, IMarkForDrop, IExtendedProperties, IScriptable, ITextObject, ISfcSupportsDesignMode

Der Trigger-Typ macht folgende Elemente verfügbar.

Konstruktoren

  Name Beschreibung
Öffentliche Methode Trigger() Initializes a new instance of the Trigger class.
Öffentliche Methode Trigger(SqlSmoObject, String) Initializes a new instance of the Trigger class on the specified object, and with the specified name.

Zum Anfang

Eigenschaften

  Name Beschreibung
Öffentliche Eigenschaft AnsiNullsStatus Gets the Boolean property value that specifies whether ISO NULL handling is enabled in the trigger.
Öffentliche Eigenschaft AssemblyName Gets or sets the name of the .NET assembly that is required by the referenced trigger.
Öffentliche Eigenschaft ClassName Gets or sets the name of the class that is called by the referenced trigger.
Öffentliche Eigenschaft CreateDate Gets the date and time when the trigger was created.
Öffentliche Eigenschaft DateLastModified Gets the date and time when the trigger was last modified.
Öffentliche Eigenschaft Delete Gets or sets the Boolean property value that specifies whether the trigger is executed when records are deleted from the table.
Öffentliche Eigenschaft DeleteOrder Gets or sets the order in which the trigger and the delete operation are executed.
Öffentliche Eigenschaft Events Gets the events that are associated with the trigger.
Öffentliche Eigenschaft ExecutionContext Gets or sets the execution context.
Öffentliche Eigenschaft ExecutionContextPrincipal Gets or sets the execution context principal.
Öffentliche Eigenschaft ExtendedProperties Gets the extended properties of the Trigger object.
Öffentliche Eigenschaft ID Gets the ID value that uniquely identifies the trigger.
Öffentliche Eigenschaft ImplementationType Gets or sets the implementation type of the trigger.
Öffentliche Eigenschaft Insert Gets or sets the Boolean property value that specifies whether the trigger is fired when records are inserted into the table.
Öffentliche Eigenschaft InsertOrder Gets or sets the order in which the trigger and the insert operation are executed.
Öffentliche Eigenschaft InsteadOf Gets or sets a Boolean property that specifies whether the trigger runs instead of the insert, delete, or update operation.
Öffentliche Eigenschaft IsEnabled Gets or sets the Boolean property that specifies whether the trigger is enabled.
Öffentliche Eigenschaft IsEncrypted Gets or sets the Boolean property value that specifies whether the trigger is encrypted.
Öffentliche Eigenschaft IsSystemObject Gets the Boolean property value that specifies whether the trigger is a system object.
Öffentliche Eigenschaft MethodName Gets the method name for the trigger.
Öffentliche Eigenschaft Name Gets or sets a String value that specifies the name of the trigger. (Überschreibt NamedSmoObject.Name.)
Öffentliche Eigenschaft NotForReplication Gets or sets a Boolean property value that specifies whether the trigger is included in replication operations.
Öffentliche Eigenschaft Parent Gets or sets the SqlSmoObject object that is the parent of the Trigger object.
Öffentliche Eigenschaft Properties Gets a collection of Property objects that represent the object properties. (Geerbt von SqlSmoObject.)
Öffentliche Eigenschaft QuotedIdentifierStatus Gets or sets a Boolean property value that specifies whether identifiers delimited by double quotation marks are Transact-SQL reserved keywords or contain characters not usually allowed by the Transact-SQL syntax rules.
Öffentliche Eigenschaft State Gets the state of the referenced object. (Geerbt von SmoObjectBase.)
Öffentliche Eigenschaft TextBody Gets or sets the Transact-SQL string that defines the trigger.
Öffentliche Eigenschaft TextHeader Gets or sets the header part of the Transact-SQL string that defines the trigger.
Öffentliche Eigenschaft TextMode Gets or sets the Boolean property that specifies whether the text header is editable as text.
Öffentliche Eigenschaft Update Gets or sets the Boolean property value that specifies whether the trigger is fired when records are updated in the table.
Öffentliche Eigenschaft UpdateOrder Gets or sets the order in which the trigger and the update operation are executed.
Öffentliche Eigenschaft Urn Gets the Uniform Resource Name (URN) address value that uniquely identifies the object. (Geerbt von SqlSmoObject.)
Öffentliche Eigenschaft UserData Gets or sets user-defined data associated with the referenced object. (Geerbt von SmoObjectBase.)

Zum Anfang

Methoden

  Name Beschreibung
Öffentliche Methode Alter Updates any Trigger object property changes on instance of Microsoft SQL Server . 
Öffentliche Methode Create Creates a trigger on the instance of SQL Server as defined by the Trigger object.
Öffentliche Methode Discover Discovers a list of type Object. (Geerbt von SqlSmoObject.)
Öffentliche Methode Drop Removes the trigger from the instance of SQL Server .
Öffentliche Methode Equals (Geerbt von Object.)
Geschützte Methode FormatSqlVariant Formats an object as SqlVariant type. (Geerbt von SqlSmoObject.)
Geschützte Methode GetContextDB Gets the context database that is associated with this object. (Geerbt von SqlSmoObject.)
Geschützte Methode GetDBName Gets the database name that is associated with the object. (Geerbt von SqlSmoObject.)
Öffentliche Methode GetHashCode (Geerbt von Object.)
Geschützte Methode GetPropValue Gets a property value of the SqlSmoObject object. (Geerbt von SqlSmoObject.)
Geschützte Methode GetPropValueOptional Gets a property value of the SqlSmoObject object. (Geerbt von SqlSmoObject.)
Geschützte Methode GetPropValueOptionalAllowNull Gets a property value of the SqlSmoObject object. (Geerbt von SqlSmoObject.)
Geschützte Methode GetServerObject Gets the server of the SqlSmoObject object. (Geerbt von SqlSmoObject.)
Öffentliche Methode GetType (Geerbt von Object.)
Öffentliche Methode Initialize() Initializes the object and forces the properties be loaded. (Geerbt von SqlSmoObject.)
Öffentliche Methode Initialize(Boolean) Initializes the object and forces the properties be loaded. (Geerbt von SqlSmoObject.)
Geschützte Methode IsObjectInitialized Verifies whether the object has been initialized. (Geerbt von SqlSmoObject.)
Geschützte Methode IsObjectInSpace Verifies whether the object is isolated or connected to the instance of SQL Server. (Geerbt von SqlSmoObject.)
Öffentliche Methode MarkForDrop Marks the trigger to be dropped.
Öffentliche Methode ReCompileReferences Recompiles any stored procedure or trigger that depends on the base SMO object.
Öffentliche Methode Refresh Refreshes the script name. (Geerbt von ScriptNameObjectBase.)
Öffentliche Methode Script() Generates a Transact-SQL script that can be used to re-create the trigger.
Öffentliche Methode Script(ScriptingOptions) Generates a Transact-SQL script that can be used to re-create the trigger as specified by the script options.
Öffentliche Methode ScriptHeader Returns the text header with the option to modify the text.
Geschützte Methode SetParentImpl Sets the parent of the SqlSmoObject to the newParent parameter. (Geerbt von SqlSmoObject.)
Öffentliche Methode ToString Returns a String that represents the referenced object. (Geerbt von SqlSmoObject.)
Öffentliche Methode Validate Validates the state of an object. (Geerbt von SmoObjectBase.)

Zum Anfang

Ereignisse

  Name Beschreibung
Öffentliches Ereignis PropertyChanged Represents the event that occurs when a property is changed. (Geerbt von SqlSmoObject.)
Öffentliches Ereignis PropertyMetadataChanged Represents the event that occurs when property metadata changes. (Geerbt von SqlSmoObject.)

Zum Anfang

Explizite Schnittstellenimplementierungen

  Name Beschreibung
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.Discover Discovers any dependencies. Verweisen Sie nicht direkt im Code auf dieses Element. Unterstützt die SQL Server-Infrastruktur. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.GetDomainRoot Returns the root of the domain. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.GetParent Gets the parent of this object. Verweisen Sie nicht direkt im Code auf dieses Element. Unterstützt die SQL Server-Infrastruktur. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.GetPropertyType Gets the type of the specified property. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.GetPropertyValue Gets the value of the specified property. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.GetUrn Gets the Unified Resource Name (URN) of the object. Verweisen Sie nicht direkt im Code auf dieses Element. Unterstützt die SQL Server-Infrastruktur. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.Resolve Gets the instance that contains the information about the object from the Unified Resource Name (URN) of the object. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.SetObjectState Sets the object state to the specified SfcObjectState value. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode IAlienObject.SetPropertyValue Sets the property value. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Methode ISfcPropertyProvider.GetPropertySet Gets the interface reference to the set of properties of this object. (Geerbt von SqlSmoObject.)
Explizite SchnittstellenimplementierungPrivate Eigenschaft ISfcSupportsDesignMode.IsDesignMode Gets a Boolean value that specifies whether the trigger supports design mode.

Zum Anfang

Hinweise

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

To set Trigger object properties, users must have ALTER permission on the parent table or view.

To create or drop a trigger, users must have ALTER permission on the parent table or view.

To grant, deny, or revoke permission on the trigger to other users, users must have CONTROL permission on the trigger.

Thread Safety

Alle öffentlichen, statischen Elemente dieses Typs (Shared in Microsoft Visual Basic) sind für Vorgänge mit mehreren Threads sicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Beispiele

Erstellen, Ändern und Löschen von Trigger

Threadsicherheit

Alle öffentlichen static (Shared in Visual Basic)-Elemente dieses Typs sind Threadsicher. Für Instanzelemente wird die Threadsicherheit nicht gewährleistet.

Siehe auch

Verweis

Microsoft.SqlServer.Management.Smo-Namespace

Andere Ressourcen

Erstellen, Ändern und Löschen von Trigger

Erstellen, Ändern und Löschen von Trigger

DML-Trigger

CREATE TRIGGER (Transact-SQL)