Compartir a través de


SqlExpression Element for ConditionAction (ADF)

Specifies the Transact-SQL query used to generate notifications from the input and subscription data.

Sintaxis

<ConditionAction>
    ...
    <SqlExpression>

Element Characteristics

Characteristic Description

Data type

string between 1 and 100000 characters.

Default value

None.

Occurrence

Required once per ConditionAction element.

Updates

You can modify this element, but cannot add or delete it when updating the application. You can add and delete the parent ConditionAction element.

Element Relationships

Relationship Elements

Parent element

ConditionAction Element (ADF)

Child elements

None.

Notas

The SqlExpression element contains the core query for generating notifications, which selects subscription and input fields and adds them to the notification table.

The query must select subscription and input fields from a view that joins subscription and input data. Subscription fields in the view have names in the form [Subscription.SubscriptionFieldName]. Input (event) fields have names in the form [Input.EventFieldName].

Subscribers create the equivalent of the WHERE clause for the query in their subscriptions through a subscription management interface. Notification Services evaluates the condition actions for all relevant subscriptions and then generates notifications.

For more information about condition actions, and a template for the Transact-SQL expression, see Definir acciones de condición.

Ejemplo

The following example shows how to define a condition action. The query in the Transact-SQL expression selects data from the MyAppSchema.WeatherEventRule view, which contains data from the subscription class and from the MyAppSchema.WeatherEvents event view.

<ConditionAction>
    <SqlLogin>[MyLowPrivLogin]</SqlLogin>
    <SqlUser>[MyLowPrivUser]</SqlUser>
    <InputName>WeatherEvents</InputName>
    <InputSchema>MyAppSchema</InputSchema>
    <SqlExpression>
        INSERT INTO MyAppSchema.WeatherNotifications(SubscriberId, 
        DeviceName, SubscriberLocale, City, Forecast) 
        SELECT [Subscription.SubscriberId], [Subscription.DeviceName], 
            [Subscription.SubscriberLocale], [Input.City], 
            [Input.Forecast])
        FROM MyAppSchema.WeatherEventRule;
    </SqlExpression>
</ConditionAction>

Vea también

Referencia

Application Definition File Reference

Conceptos

Instance Configuration File Reference

Otros recursos

INSERT (Transact-SQL)
SELECT (Transact-SQL)
Definir acciones de condición
Definir reglas de suscripción

Ayuda e información

Obtener ayuda sobre SQL Server 2005