SqlTriggerAttribute.Target Property

Definition

The table to which the trigger applies.

C#
public string Target { get; set; }

Property Value

A String value representing the table name.

Examples

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

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

Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1