SubscriptionScheduledRule.Action Property
Gets or sets the Transact-SQL query for the scheduled 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)
Eigenschaftswert
A String, between 1 and 100,000 characters in length, that specifies the Transact-SQL query to run each time the rule is fired.
Hinweise
An action is a group of Transact-SQL statements that Notification Services runs each time it fires the rule. For more information, see Definieren von Aktionen.
Beispiel
The following examples show how to define a scheduled rule and add it to a subscription class:
// Add a rule to generate basic scheduled notifications
SubscriptionScheduledRule flightScheduledRule =
new SubscriptionScheduledRule(
flightSubscriptions, "FlightScheduledRule");
flightScheduledRule.Action = "INSERT INTO FlightNotifications " +
"(SubscriberId, DeviceName, SubscriberLocale, " +
" LeavingFrom, GoingTo, Price) " +
" SELECT S.SubscriberId, S.DeviceName, S.SubscriberLocale, " +
" EC.LeavingFrom, EC.GoingTo, EC.Price " +
" FROM FlightEventChronicle EC, FlightSubscriptions S " +
" WHERE EC.LeavingFrom = S.LeavingFrom " +
" AND EC.GoingTo = S.GoingTo " +
" AND EC.Price < S.Price";
flightScheduledRule.ActionTimeout = new TimeSpan(0, 0, 30);
flightSubscriptions.SubscriptionScheduledRules.Add(
flightScheduledRule);
' Add a rule to generate basic scheduled notifications
Dim flightScheduledRule As SubscriptionScheduledRule = _
New SubscriptionScheduledRule(flightSubscriptions, _
"FlightScheduledRule")
flightScheduledRule.Action = _
"INSERT INTO FlightNotifications " + _
"(SubscriberId, DeviceName, SubscriberLocale, " + _
"LeavingFrom, GoingTo, Price) " + _
"SELECT S.SubscriberId, S.DeviceName, S.SubscriberLocale, " + _
"EC.LeavingFrom, EC.GoingTo, EC.Price " + _
"FROM FlightEventChronicle EC, FlightSubscriptions S " + _
"WHERE EC.LeavingFrom = S.LeavingFrom " + _
"AND EC.GoingTo = S.GoingTo " + _
"AND EC.Price < S.Price"
flightScheduledRule.ActionTimeout = New TimeSpan(0, 0, 30)
flightSubscriptions.SubscriptionScheduledRules.Add( _
flightScheduledRule)
Threadsicherheit
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.
Plattformen
Entwicklungsplattformen
Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.
Zielplattforme
Eine Liste der unterstützten Plattformen finden Sie unterHardware- und Softwareanforderungen für die Installation von SQL Server 2005.
Siehe auch
Verweis
SubscriptionScheduledRule Class
SubscriptionScheduledRule Members
Microsoft.SqlServer.Management.Nmo Namespace
Andere Ressourcen
Definieren von geplanten Regeln
Action Element for ScheduledRule (ADF)
ScheduledRule Element (ADF)