Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

SubscriptionScheduledRule Class

SQL Server 2005

Represents a scheduled rule that contains actions, not condition actions.

Namespace: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

public sealed class SubscriptionScheduledRule : NamedSmoObject
public final class SubscriptionScheduledRule extends NamedSmoObject
public final class SubscriptionScheduledRule extends NamedSmoObject

The SubscriptionScheduledRule class represents a rule that uses simple parameter-based Transact-SQL queries to generate notifications for scheduled subscriptions.

Each SubscriptionScheduledRule object must specify an action, which is a Transact-SQL query that does the work of the rule. A subscription class can have multiple SubscriptionScheduledRule objects, and can also have SubscriptionConditionScheduledRule, SubscriptionEventRule, and SubscriptionConditionEventRule objects.

SubscriptionScheduledRule objects are associated with a subscription class through the SubscriptionScheduledRules property.

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);

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.

Development Platforms

For a list of the supported platforms, see Hardware and Software Requirements for Installing SQL Server 2005.

Target Platforms

Community Additions

© 2015 Microsoft