MID Function

Extracts a substring from an argument.

Category: String
Returned data type: String

Syntax

MID(source, position<, length>)

Required Arguments

source

specifies a string to search; this can be specified as string constant, field name, or expression.

position

specifies an integer that is the beginning character position; this can be specified as a numeric constant, field name, or expression.

Optional Argument

length

specifies an integer that is the length of the substring to extract; this can be specified as a numeric constant, field name, or expression.

Default If length is omitted, the remainder of the string will be extracted.
Note If length is NULL, zero, or larger than the length of the expression that remains in source after position, the remainder of the expression is returned.

Example

source = "06MAY15"
 
result = mid(source, 3, 3) // outputs "MAY"
result = mid(source, 3) // outputs "MAY15"