Share via


Action Element for ScheduledRule (ADF)

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

Syntax

<SubscriptionClasses>
    <SubscriptionClass>
        ...
        <ScheduledRules>
            <ScheduledRule>
                ...
                <Action>

Element Characteristics

Characteristic Description

Data type

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

Default value

None.

Occurrence

Required once per ScheduledRule element.

Updates

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

Element Relationships

Relationship Elements

Parent element

ScheduledRule Element (ADF)

Child elements

None.

Example

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

<Action>
-- Insert notifications into scheduled notification class view
INSERT INTO ScheduledNotifications (SubscriberId, 
    DeviceName, SubscriberLocale, StockSymbol, 
    StockPrice )
SELECT S.SubscriberId, S.DeviceName, S.SubscriberLocale,
        C.StockSymbol, C.StockPrice
    FROM StockSubscriptions S JOIN StockEventChron C
    ON S.StockSymbol = C.StockSymbol 
    WHERE S.StockTriggerPrice &lt;= C.StockHighPrice 
    GROUP BY S.StockSymbol, C.StockHighPrice;
-- Update subscription chronicle
INSERT StockSubscriptionChron (SubscriberId, StockSymbol, StockPrice)
SELECT S.SubscriberId, S.StockSymbol, C.StockHighPrice
    FROM StockSubscriptions S JOIN StockEventChron C
    ON S.StockSymbol = C.StockSymbol;
</Action>

See Also

Reference

Application Definition File Reference

Other Resources

Defining Scheduled Rules
Defining Subscription Rules
Updating Instances and Applications

Help and Information

Getting SQL Server 2005 Assistance