SqlLogin Element (ADF)

Specifies the Microsoft SQL Server login account associated with the database user that runs the matching logic in condition actions.

Syntax

<ConditionAction>
    <SqlLogin>

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.

Remarks

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.

You specify the database user in the SqlUser element. You specify the login account that is associated with the user in the SqlLogin element. The login must exist before Notification Services creates the application. If the login does not exist, Notification Services will fail when attempting to create the application and will roll back the instance creation or instance update. The login must continue to exist while the application is deployed.

The SqlLogin can be a SQL Server Authentication login or a Microsoft Windows Authentication login.

Make sure the login has restricted permissions on the server. It is best for the login to have no server-wide permissions and to belong to no server roles.

For more information condition actions, see Defining Condition Actions.

Example

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>

See Also

Reference

SqlUser Element (ADF)
Application Definition File Reference

Concepts

Instance Configuration File Reference

Other Resources

Defining Condition Actions
Defining Subscription Rules
CREATE LOGIN (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance