SqlTriggerAttribute.Target Property

The table to which the trigger applies.

Namespace:  Microsoft.SqlServer.Server
Assembly:  System.Data (in System.Data.dll)

public string Target { get; set; }

Property Value

Type: System.String
A String value representing the table name.

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.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft