EventChronicleRule.Action Property
Gets or sets the Transact-SQL statements that specify the actions to perform for the event chronicle rule.
Namespace: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)
Syntax
'Declaration
Public Property Action As String
public string Action { get; set; }
public:
property String^ Action {
String^ get ();
void set (String^ value);
}
/** @property */
public String get_Action ()
/** @property */
public void set_Action (String value)
public function get Action () : String
public function set Action (value : String)
Property Value
A String of up to 100,000 characters that specifies the Transact-SQL statements to execute each time the event chronicle rule runs.
Remarks
The Transact-SQL statements should maintain the event chronicle. Often you will select data from the current event class and update the event chronicle as appropriate for your application.
The action can contain calls to stored procedures.
Example
The following example shows how to create an event chronicle rule that simply copies all events to a chronicle:
// Define the event chronicle rule
EventChronicleRule ec1Rule =
new EventChronicleRule(flightEvents,
"FlightEventChronicleRule");
ec1Rule.Action = "INSERT MyAppSchema.FlightEventChronicle " +
" (LeavingFrom, GoingTo, Price) " +
" SELECT LeavingFrom, GoingTo, Price " +
" FROM MyAppSchema.FlightEvents;";
ec1Rule.ActionTimeout = new TimeSpan(0, 1, 20);
flightEvents.EventChronicleRule = ec1Rule;
' Define the event chronicle rule
Dim ec1Rule As EventChronicleRule = _
New EventChronicleRule(flightEvents, _
"FlightEventChronicleRule")
ec1Rule.Action = _
"INSERT MyAppSchema.FlightEventChronicle " + _
" (LeavingFrom, GoingTo, Price) " + _
" SELECT LeavingFrom, GoingTo, Price " + _
" FROM MyAppSchema.FlightEvents;"
ec1Rule.ActionTimeout = New TimeSpan(0, 1, 20)
flightEvents.EventChronicleRule = ec1Rule
Thread Safety
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms
Development Platforms
For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.
Target Platforms
For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.
See Also
Reference
EventChronicleRule Class
EventChronicleRule Members
Microsoft.SqlServer.Management.Nmo Namespace
Other Resources
Defining Event Chronicle Rules
Action Element for ChronicleRule (ADF)