ProtocolField.SqlExpression Property

Gets or sets the Transact-SQL expression that computes the protocol field value.

Espace de noms: Microsoft.SqlServer.Management.Nmo
Assembly: Microsoft.SqlServer.Smo (in microsoft.sqlserver.smo.dll)

Syntaxe

'Déclaration
Public Property SqlExpression As String
public string SqlExpression { get; set; }
public:
property String^ SqlExpression {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_SqlExpression ()

/** @property */
public void set_SqlExpression (String value)
public function get SqlExpression () : String

public function set SqlExpression (value : String)

Valeur de propriété

A String, between 0 and 4000 characters in length, that specifies the Transact-SQL statement that computes the field value.

Notes

A Transact-SQL expression is a combination of identifiers, values, and operators that the Moteur de base de données can evaluate to get a result. You can use any expression that can be part of a SELECT statement. The terms of the expression can be any of the following:

  • Constants.

  • Calls to functions.

  • The notification fields defined in the ADF (but not computed fields).

  • The following built-in notification fields:

    • SubscriberId

    • DeviceName

    • DeviceTypeName

    • DeviceAddress

    • SubscriberLocale

    • DeliveryChannelName

For more information, see Expressions (moteur de base de données).

Enclose string constants in single quotation marks.

If the ProtocolField does not use a SqlExpression property it must use a FieldReference property instead.

Exemple

The following examples show how to define a protocol field that uses a Transact-SQL expression to generate the protocol field value:

ProtocolField smtpProtocolField1 = 
    new ProtocolField(smtpProtocol, "Subject");
smtpProtocolField1.SqlExpression = 
    "'Flight notification: '+CONVERT (NVARCHAR(30), GETDATE())";
smtpProtocol.ProtocolFields.Add(smtpProtocolField1);
Dim smtpProtocolField1 As ProtocolField = _
    New ProtocolField(smtpProtocol, "Subject")
smtpProtocolField1.SqlExpression = _
    "'Flight notification: '+CONVERT (NVARCHAR(30), GETDATE())"
smtpProtocol.ProtocolFields.Add(smtpProtocolField1)

Sécurité des threads

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.

Plateformes

Plateformes de développement

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Plateformes cibles

Pour obtenir la liste des plateformes prises en charge, consultez Configuration matérielle et logicielle requise pour l'installation de SQL Server 2005.

Voir aussi

Référence

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

Autres ressources

Protocol Element (ADF)
SqlExpression Element for Protocol/Fields/Field (ADF)