Partager via


SqlUser Element (ADF)

Specifies the name of the database user used to run the condition action.

Syntaxe

<ConditionAction>
    ...
    <SqlUser>

Element Characteristics

Characteristic Description

Data type

string.

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.

Notes

All condition actions execute in the context of a database user that you specify for the condition action. Using a low-privileged user minimizes the security threat in case anyone compromises your subscription management interface and inserts conditions that attempt to access other tables or perform other actions.

Specify the database user in the SqlUser element. Notification Services creates the user account; it cannot exist before you create the application.

Make sure the database user, and its associated Microsoft SQL Server Login, which is named in the SqlLogin element, has restricted permissions in the database. Also make sure the user and the associated SqlLogin are not likely to be removed from the server or the domain while the application is deployed, as this will cause application errors.

Notification Services grants the necessary permissions on Notification Services objects, but does not grant permissions on the input tables or views, nor does it grant permissions on any user-defined functions that are used by condition actions. You will need to grant these permissions when deploying the application. For more information about granting these permissions, see Définition des actions de condition.

Exemple

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>

Voir aussi

Référence

SqlLogin Element (ADF)
Application Definition File Reference

Concepts

Instance Configuration File Reference

Autres ressources

Définition des actions de condition
Définition de règles d'abonnement

Aide et Informations

Assistance sur SQL Server 2005