SubscriptionConditionEventRule.SqlUserName Property

Gets or sets the name of the database user Notification Services creates to run the statements specified in the SqlExpression property.

Espacio de nombres: Microsoft.SqlServer.Management.Nmo
Ensamblado: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Sintaxis

'Declaración
Public Property SqlUserName As String
public string SqlUserName { get; set; }
public:
property String^ SqlUserName {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_SqlUserName ()

/** @property */
public void set_SqlUserName (String value)
public function get SqlUserName () : String

public function set SqlUserName (value : String)

Valor de propiedad

A String that specifies the database user name Notification Services creates. Database user names typically, but are not required to, match their associated login name.

Notas

All SubscriptionConditionEventRule rules execute in the context of a database user that you specify. 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.

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 using the SqlLoginName property, 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 needs to grant these permissions when deploying the application. For more information about granting these permissions, see Definir acciones de condición.

Ejemplo

The following example shows how to define a condition-based, event-driven subscription rule and add it to a subscription class:

// Add a rule to generate condition-based, event notifications
SubscriptionConditionEventRule flightConditionEventRule = 
    new SubscriptionConditionEventRule(
    flightSubscriptions, "FlightConditionEventRule");
flightConditionEventRule.EventClassName = "FlightEvents";
flightConditionEventRule.ActionTimeout = new TimeSpan(0, 2, 0);
flightConditionEventRule.SqlLoginName = "MyLowPrivLogin";
flightConditionEventRule.SqlUserName = "MyLowPrivUser";
flightConditionEventRule.InputTypeName = "FlightEvents";
flightConditionEventRule.InputTypeSchema = "MyAppSchema";
flightConditionEventRule.SqlExpression =
    "INSERT INTO MyAppSchema.FlightNotifications (SubscriberId, " +
    "DeviceName, SubscriberLocale, LeavingFrom, GoingTo, Price) " +
    "SELECT [Subscription.SubscriberId], [Subscription.DeviceName], " +
    "[Subscription.SubscriberLocale], " +
    "[Input.LeavingFrom], [Input.GoingTo], [Input.Price] " +
    "FROM MyAppSchema.FlightConditionEventRule;";
flightSubscriptions.SubscriptionConditionEventRules.Add(
    flightConditionEventRule);
' Add a rule to generate condition-based, event notifications
Dim flightConditionEventRule As _
    SubscriptionConditionEventRule = _
    New SubscriptionConditionEventRule( _
    flightSubscriptions, "FlightConditionEventRule")
flightConditionEventRule.EventClassName = "FlightEvents"
flightConditionEventRule.ActionTimeout = New TimeSpan(0, 2, 0)
flightConditionEventRule.SqlLoginName = "MyLowPrivLogin"
flightConditionEventRule.SqlUserName = "MyLowPrivUser"
flightConditionEventRule.InputTypeName = "FlightEvents"
flightConditionEventRule.InputTypeSchema = "MyAppSchema"
flightConditionEventRule.SqlExpression = _
 "INSERT INTO MyAppSchema.FlightNotifications " + _
 "(SubscriberId, DeviceName, SubscriberLocale, LeavingFrom, " + _
 "GoingTo, Price) SELECT [Subscription.SubscriberId], " + _
 "[Subscription.DeviceName], [Subscription.SubscriberLocale], " + _
 "[Input.LeavingFrom], [Input.GoingTo], [Input.Price] " + _
 "FROM MyAppSchema.FlightConditionEventRule;"
flightSubscriptions.SubscriptionConditionEventRules.Add( _
    flightConditionEventRule)

Seguridad para subprocesos

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Plataformas

Plataformas de desarrollo

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Plataformas de destino

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Vea también

Referencia

SubscriptionConditionEventRule Class
SubscriptionConditionEventRule Members
Microsoft.SqlServer.Management.Nmo Namespace

Otros recursos

SqlUser Element (ADF)
Definir reglas de evento
Definir acciones de condición
EventRule Element (ADF)
ConditionAction Element (ADF)