共用方式為


EventRules Element (ADF)

Provides a location for all of the subscription event rule definitions for one subscription class.

語法

<SubscriptionClasses>
    <SubscriptionClass>
        ...
        <EventRules>

Element Characteristics

Characteristic Description

Data type

None.

Default value

None.

Occurrence

Optional once per SubscriptionClass element.

Updates

Can be added and deleted when updating the application.

Element Relationships

Relationship Elements

Parent element

SubscriptionClass Element (ADF)

Child elements

EventRule Element (ADF)

範例

The following example shows an EventRules element and its child elements. The rule creates event-driven notifications, and also loads notification data into the StockSubscriptionChron table. It is executed whenever an event batch containing events of the StockEvents class is processed. This rule is permitted one minute to complete successfully.

<EventRules>
    <EventRule>
        <RuleName>StockSubscriptionEventRule</RuleName>
        <Action>
        -- Generate notifications from event and chronicle data
        INSERT INTO StockNotifications 
        ( SubscriberId, DeviceName, SubscriberLocale,
          StockSymbol, StockPrice )
        SELECT S.SubscriberId, S.DeviceName,
          S.SubscriberLocale, E.StockSymbol, E.StockPrice
        FROM StockSubscriptions S JOIN StockEvents E
        ON S.StockSymbol = E.StockSymbol
        JOIN StockEventChron C
        ON S.StockSymbol = C.StockSymbol
        WHERE S.StockTriggerPrice &lt;= E.StockPrice
        AND S.StockTriggerPrice &gt; C.StockHighPrice
        -- Update subscription chronicle
        INSERT StockSubscriptionChron
        (SubscriberId, StockSymbol, StockPrice)
        SELECT S.SubscriberId, S.StockSymbol, E.StockPrice
        FROM StockSubscriptions S JOIN StockEvents E
        ON S.StockSymbol = E.StockSymbol
        </Action>
        <ActionTimeout>P0DT00H01M00S</ActionTimeout>
        <EventClassName>StockEvents</EventClassName>
    </EventRule>
</EventRules>

請參閱

參考

Application Definition File Reference

其他資源

定義事件規則
更新執行個體及應用程式

說明及資訊

取得 SQL Server 2005 協助