Export (0) Print
Expand All

SqlRuleAction.SqlExpression Property

Gets the SQL expression.

Namespace:  Microsoft.ServiceBus.Messaging
Assembly:  Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)

[DataMemberAttribute(Name = "SqlExpression", Order = , EmitDefaultValue = false, 
	IsRequired = true)]
public string SqlExpression { get; private set; }

Property Value

Type: System.String
The SQL expression.

NoteNote

Only alphanumeric characters and a dot character (".") are supported for filter names at this time

The SQL grammar is as follows:

<statements> ::=
<statement> [, ...n] 

<statement> ::=
<action> [;]

The semicolon is optional.

<action> ::=
SET <property> = <expression>
REMOVE <property>

<expression> ::=
<literal>
| <function> ::= 
     newid()
| <property>
| <expression> { + | - | * | / } <expression>
| { + | - } <expression>
| ( <expression> ) 

Remarks

newid() is used to generate a Guid. The function calls the System.Guid.NewGuid method to generate.

Syntax

<property> := 
 [<scope> .] <property_name>

Arguments

<scope>

An optional string indicating the scope of the <property_name>. Valid values are "sys" or "user". "sys" indicates system scope where <property_name> is a public property name of the BrokeredMessage class. "user" indicates user scope where <property_name> is a key of the Properties dictionary. "user" scope is the default scope if <scope> is not specified.

An attempt to access a non-existing system property is an error, while an attempt to access a non-existing user property is not an error. Instead, the non-existing user property is evaluated as an unknown value. An unknown value is treated specially during operator evaluation.

Syntax

<property_name> ::=
<property_name_part>

<scope> ::=
<property_name_part>

<property_name_part> ::=
<identifier>
| <delimited_identifier>

<identifier> ::=
<regular_identifier> | <quoted_identifier> | <delimited_identifier>

Arguments

<regular_identifier>

A string represented by the following regular expression: [[:IsLetter:]][_[:IsLetter:][:IsDigit:]]*. This includes any string that starts with a letter and is followed by one or more underscores/letters/digits.

[:IsLetter:] is any Unicode character that is categorized as a Unicode letter. System.Char.IsLetter(c) returns true if c is a Unicode letter.

[:IsDigit:] is any Unicode character that is categorized as a decimal digit. System.Char.IsDigit(c) returns true if c is a Unicode digit.

A <regular_identifier> cannot be a reserved keyword.

<delimited_identifier>

Any string that is enclosed with left or right square brackets ([]). A right square bracket is represented as two right square brackets. The following are examples of <delimited_identifier>:

[Property With Space]
[HR-EmployeeID]
<quoted_identifier>

Any string that is enclosed with double quotation marks. A double quotation mark in an identifier is represented as two double quotation marks. It is not recommended to use quoted identifiers because it can easily be confused with a string constant. Use a delimited identifier if possible. The following are examples of <quoted_identifier>:

"Contoso & Northwind"

Syntax

<constant> ::=
<long_constant> | <double_constant> | <boolean_constant> | NULL

<constant> ::=
<integer_constant> | <decimal_constant> | <approximate_number_constant> | <boolean_constant> | NULL

Arguments

<integer_constant>

A string of numbers that are not enclosed in quotation marks and do not contain decimal points. The values are stored as Sysem.Int64 and follow the same range. The following are examples of long constants:

1894
2
<decimal_constant>

A string of numbers that are not enclosed in quotation marks and contain a decimal point. The values are stored as System.Double and follow the same range/precision. Do not rely on the fact the underlying data type is System.Double for <decimal_constant>, as this is subject to change in the future.

The following are examples of decimal constants:

1894.1204
2.0
<approximate_number_constant>

A number written in scientific notiation. The values are stored as System.Double and follow the same range/precision. The following are examples of approximate number constants:

101.5E5
0.5E-2
<boolean_constant> :=
TRUE | FALSE

Boolean constants are represented by keyword TRUE or FALSE. The values are stored as System.Boolean.

<string_constant>

String constants are enclosed in single quotation marks and include any valid Unicode characters. A single quotation mark embedded in a string constant is represented as two single quotation marks.

Consider the following semantics in the language:

  • SET is used to create a new property or update the value of an existing property.

  • REMOVE is used to remove a property.

  • SET performs implicit conversion, if possible, when the expression type and the existing property type are different.

  • The action fails if non-existing system properties are referenced.

  • The action does not fail if non-existing user properties are referenced.

  • A non-existing user property is evaluated as "Unknown" and follows the same semantic as SqlFilter when evaluating operators.

  • The NEWID() function is used to return a new GUID string literal in a rule action. You can expect the value to become a string if you have an existing string property on the left side of your assignment operator in the rule action via implicit conversion as mentioned above.

Community Additions

ADD
Show:
© 2014 Microsoft