Share via


SqlTriggerAttribute.Target Property

Definition

The table to which the trigger applies.

public:
 property System::String ^ Target { System::String ^ get(); void set(System::String ^ value); };
public string Target { get; set; }
member this.Target : string with get, set
Public Property Target As String

Property Value

A String value representing the table name.

Examples

public partial class Triggers
{
    [SqlTrigger(Name="trig_onpubinsert", Target="publishers", Event="FOR INSERT")]
    public static void PublishersInsertTrigger()
    {
        //...
    }
}
Partial Public Class Triggers

    <SqlTrigger(Name:="trig_onpubinsert", Target:="publishers", Event:="FOR INSERT")>
    Public Shared Sub PublishersInsertTrigger()

        '...
    End Sub
End Class

Remarks

The Target property is required.

The following example specifies that the trigger is referenced by using the name trig_onpubinsert. The trigger is activated by adding new data (INSERT) to the table publishers.

Applies to