Action Element for EventRule (ADF)

Provides a Transact-SQL statement that specifies the action to be taken in a subscription event rule.

Синтаксис

<SubscriptionClasses>
    <SubscriptionClass>
        ...
        <EventRules>
            <EventRule>
                ...
                <Action>

Element Characteristics

Characteristic Description

Data type

string, between 1 and 100,000 characters in length.

Default value

None.

Occurrence

Required once per EventRule element.

Updates

Can be modified, but not added or deleted, when updating the application.

Element Relationships

Relationship Elements

Parent element

EventRule Element (ADF)

Child elements

None.

Пример

This example shows a populated Action element for an EventRule. The Transact-SQL statements use a notification function to create notifications, and also insert event data into a chronicle table.

<Action>
-- Insert notifications into StockNotifications view
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 the 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>

См. также

Справочник

Application Definition File Reference

Другие ресурсы

Определение правил событий
Определение правил подписок
Обновление экземпляров и приложений

Справка и поддержка

Получение помощи по SQL Server 2005