Icon SUBSTRING

Extracts a portion of a string value.

Syntax
SUBSTRING(<StringExpression> FROM <IntegerExpression>
          [FOR <IntegerExpression>])
SUBSTRING(<StringExpression>, <IntegerExpression>
          [, <IntegerExpression>])
SUBSTR(<StringExpression> FROM <IntegerExpression>
       [FOR <IntegerExpression>])
SUBSTR(<StringExpression>, <IntegerExpression>
       [, <IntegerExpression>])

<StringExpression> = 

Type of:

CHARACTER|CHAR
CHARACTER VARYING|VARCHAR
GUID
CHARACTER LARGE OBJECT|CLOB

Returns
Same as input

Usage
The SUBSTRING function extracts a portion of a string value. The second FROM parameter is the character position at which the extracted string starts within the original string. The index for the FROM parameter is based on the first character in the source value being 1.

The FOR parameter is optional, and specifies the length of the extracted string. If the FOR parameter is omitted, the extracted string will be equal to the portion of the string starting at the position specified by the FROM parameter to the end of the string.

Examples
SELECT SUBSTRING(CustomerID, 8 FOR 2) AS Category
FROM Customers

SQL 2003 Standard Deviations
This function deviates from the SQL 2003 standard in the following ways:

DeviationDetails
Argument SeparatorThe use of a comma separator for the function arguments is an ElevateDB extension.
SIMILARElevateDB does not support the SIMILAR syntax for regular expression matching.
Image