Expressions (SQL Server Compact Edition)
A combination of symbols and operators that the database system evaluates to obtain a single data value. Simple expressions can be a single constant, variable, column, or scalar function. Operators can be used to join two or more simple expressions into a complex expression.
 constant

A symbol that represents a single, specific data value. A constant is one or more alphanumeric characters (letters az and AZ) or symbols (such as !, @, #). Unicode character and datetime values are enclosed in quotation marks. Binary strings and numeric constants are not.
 scalar_function

A unit of SQL syntax that provides a specific service and returns a single value.
 [ alias.]

The alias, or correlation name, assigned to a table by the AS keyword in the FROM clause.
 column

The name of a column.
 ( expression )

Any valid expression in Microsoft SQL Server 2005 Compact Edition (SQL Server Compact Edition). The parentheses are grouping operators that ensure that all the operators in the expression within the parentheses are evaluated before the resulting expression is combined with another.
 { unary_operator}

An operator that has only one numeric operand:

+ indicates a positive number.

 indicates a negative number.

~ indicates the complement operator.
Unary operators can be applied only to expressions that evaluate to one or more of the data types of the numeric data type category.

+ indicates a positive number.
 { binary_operator}

An operator that defines the way two expressions are combined to yield a single result. A binary_operator can be an arithmetic operator, the assignment operator (=), a bitwise operator, a comparison operator, a logical operator, the string concatenation operator (+), or a unary operator. For more information, see Operators (SQL Server Compact Edition).
For a simple expression built of a single constant, variable, scalar function, or column name, the data type, precision, scale, and value of the expression is the data type, precision, scale, and value of the referenced element.
When two expressions are combined by using comparison or logical operators, the resulting data type is Boolean and the value is one of the following:

TRUE

FALSE

UNKNOWN
When two expressions are combined by using arithmetic, bitwise, or string operators, the resulting data type is determined by the operator.
Complex expressions made up of many symbols and operators evaluate to a singlevalued result. The data type, precision, and value of the resulting expression are determined by combining the component expressions two at a time until a final result is reached. The sequence in which the expressions are combined is defined by the precedence of the operators in the expression.
An operator can combine two expressions if they both have data types supported by the operator and at least one of the following conditions is true:

The expressions have the same data type.

The data type with the lower precedence can be implicitly converted to the data type with the higher data type precedence.
If there is no supported implicit conversion, the two expressions cannot be combined.
In a programming language such as Microsoft Visual Basic, an expression always evaluates to a single result. Expressions in an SQL select list have a variation on this rule: The expression is evaluated individually for each row in the result set. A single expression might have a different value in each row of the result set, but each row has only one value for the expression. For example, in this SELECT statement, both the reference to ProductID and the term 1+2 in the select list are expressions:
SELECT ProductID, 1+2 FROM Products
The expression 1+2 evaluates to 3 in each row in the result set. Although the expression ProductID generates a unique value in each result set row, each row has only one value for ProductID.