Expressions can include numeric, string, and Boolean literals. The expression evaluator supports a variety of numeric literals such as integers, decimals, and floating-point constants. The expression evaluator also supports the long and float suffixes, which specify how the expression evaluator handles values, and scientific notation in numeric literals.
The expression evaluator supports integral and nonintegral numeric data types. It also supports lineage identifiers, which are the unique numeric identifiers for package elements. Lineage identifiers are numbers, but they cannot be used in mathematical operations.
The expression evaluator supports suffixes, which you can use to indicate how the expression evaluator treats the numeric literal. For example, you can indicate the integer 37 be treated as a long integer data type by writing 37L or 37l.
The following table lists suffixes for numeric literals.
L or l
A long numeric literal.
U or u
An unsigned numeric literal.
E or e
The exponent in scientific notation
The following table lists numeric expression elements and their regular expressions.
Digits expressed as D.
Scientific notation expressed as E.
Upper or lowercase e, optionally + or -, and one or more digits as defined in D.
Integer suffix expressed as IS.
Optionally, upper or lowercase u and l or a combination of u and l. U or u indicates an unsigned value. L or l indicates a long value.
Float suffix expressed as FS.
Upper or lowercase f or l. F or f indicates a float value (DT_R4 data type). L or l indicates a long value (DT_R8 data type).
Hexadecimal digit expressed as H.
Any hexadecimal digit.
The following table describes valid numeric literals using the regular expression language.
An integral numeric literal with at least one digit (D) and, optionally, the long and/or the unsigned suffix (IS). Examples: 457, 785u, 986L, and 7945ul.
A nonintegral numeric literal with at least one digit (D), scientific notation, and the long or the float suffix. Examples: 4E8l, 13e-2f, and 5E+L.
A nonintegral numeric literal with a decimal place, a decimal fraction with at least one digit (D), an optional exponent (E), and one float or one long identifier (FS). This numeric literal has the DT_R4 or DT_R8 data type. Examples: 6.45E3f, .89E-2l, and 1.05E+7F.
A nonintegral numeric literal with at least one significant digit (D), a decimal place, an exponent (E), and one float or one long identifier (FS). This numeric literal has the DT_R4 or DT_R8 data type. Examples: 1.E-4f, 4.6E6L, and 8.365E+2f.
A nonintegral numeric literal with precision and scale. It has a decimal place and a decimal fraction with at least one digit (D). This numeric literal has the DT_NUMERIC data type. Examples: .9, 5.8, and 0.346.
A nonintegral numeric literal with precision and scale. It has at least one significant digit (D) and a decimal place. This numeric literal has the DT_NUMERIC data type. Examples: 6., 0.2, and 8.0.
A lineage identifier. It consists of the pound (#) character and at least one digit (D). Examples: #123.
A numeric literal in hexadecimal format. It includes a zero, an upper or lowercase x, at least one uppercase H, and, optionally, the unsigned suffix. Examples: 0xFF0A and 0X000010000U.
For more information about the data types the expression evaluator uses, see Integration Services Data Types.
Expressions can include numeric literals with different data types. When the expression evaluator evaluates these expressions, it converts the data to compatible types. For more information, see Integration Services Data Types in Expressions.
However, conversion between some data types requires an explicit cast. The expression evaluator provides the cast operator for performing explicit data type conversion. For more information, see Cast (SSIS Expression).
The expression evaluator performs the following conversions when evaluating numeric literals:
An integral numeric literal is mapped to an integer data type as follows.
If the long (L or l) suffix is absent, the expression evaluator maps signed values to the DT_I4 data type and unsigned values to the DT_UI4 data type even though the value overflows the data type.
A numeric literal that includes an exponent is converted to either the DT_R4 or the DT_R8 data type. If the expression includes the long suffix, it is converted to DT_R8; if it includes the float suffix, it is converted to the DT_R4 data type.
If a nonintegral numeric literal includes F or f, it maps to the DT_R4 data type. If it includes L or l and the number is an integer, it maps to the DT_I8 data type. If it is a real number, it maps to the DT_R8 data type. If it includes the long suffix, it is converted to the DT_R8 data type.
A nonintegral numeric literal with precision and scale maps to the DT_NUMERIC data type.
String literals must be enclosed in quotation marks. The expression language provides a set of escape sequences for commonly escaped characters such as nonprinting characters and quotation marks.
A string literal consists of zero or more characters surrounded by quotation marks. If a string contains quotation marks, these must be escaped in order for the expression to parse. Any two-byte character except \x0000 is permitted in a string, because the \x0000 character is the null terminator of a string.
Strings can include other characters that require an escape sequence. The following table lists escape sequences for string literals.
Unicode character in hexadecimal notation
The expression evaluator supports the usual Boolean literals: True and False. The expression evaluator is not case-sensitive and any combination of uppercase and lowercase letters are permitted. For example, TRUE works just as well as True.
In an expression, a Boolean literal must be delimited by spaces.
Technical article, SSIS Expression Cheat Sheet, on pragmaticworks.com