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

SubscriptionConditionEventRule Class

SQL Server 2005

Describes an event rule that uses condition actions to generate notifications.

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

public sealed class SubscriptionConditionEventRule : NamedSmoObject
public final class SubscriptionConditionEventRule extends NamedSmoObject
public final class SubscriptionConditionEventRule extends NamedSmoObject

A SubscriptionConditionEventRule object is a subscription rule that runs during each generator quantum that has an event batch to process, and runs against subscriptions that use conditions.

A SubscriptionClass object can have zero or more SubscriptionConditionEventRule objects. A SubscriptionClass object can also use the following types of subscription rules: SubscriptionConditionScheduledRule, SubscriptionEventRule, and SubscriptionScheduledRule.

For more information about subscription rules, see Defining Subscription Rules.

Add individual SubscriptionConditionEventRule objects to a SubscriptionClass object using the SubscriptionConditionEventRules property, which returns a SubscriptionConditionEventRuleCollection object.


The following example shows how to define a condition-based, event-driven subscription rule and add it to a subscription class:

// Add a rule to generate condition-based, event notifications
SubscriptionConditionEventRule flightConditionEventRule = 
    new SubscriptionConditionEventRule(
    flightSubscriptions, "FlightConditionEventRule");
flightConditionEventRule.EventClassName = "FlightEvents";
flightConditionEventRule.ActionTimeout = new TimeSpan(0, 2, 0);
flightConditionEventRule.SqlLoginName = "MyLowPrivLogin";
flightConditionEventRule.SqlUserName = "MyLowPrivUser";
flightConditionEventRule.InputTypeName = "FlightEvents";
flightConditionEventRule.InputTypeSchema = "MyAppSchema";
flightConditionEventRule.SqlExpression =
    "INSERT INTO MyAppSchema.FlightNotifications (SubscriberId, " +
    "DeviceName, SubscriberLocale, LeavingFrom, GoingTo, Price) " +
    "SELECT [Subscription.SubscriberId], [Subscription.DeviceName], " +
    "[Subscription.SubscriberLocale], " +
    "[Input.LeavingFrom], [Input.GoingTo], [Input.Price] " +
    "FROM MyAppSchema.FlightConditionEventRule;";
flightSubscriptions.SubscriptionConditionEventRules.Add(
    flightConditionEventRule);

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

ADD
Show:
© 2015 Microsoft