Returns a specified number of characters from the beginning
of a string.
Syntax
LEFT ( string-expression, numeric-expression )
Parameters
ParametersParameter
|
Description
|
string-expression
|
The string.
|
numeric-expression
|
The number of characters to return.
|
Returns
LONG VARCHAR
LONG NVARCHAR
Note: The
result data type is a LONG
VARCHAR. If you use LEFT in a SELECT
INTO statement, you must have an Unstructured Data Analytics
Option license or use CAST and set LEFT to
the correct data type and size.
Example
The following statement returns the value “choco”:
SELECT LEFT( 'chocolate', 5 ) FROM iq_dummy
Usage
If the string contains multibyte characters, and the proper
collation is being used, the number of bytes returned may be greater
than the specified number of characters.
Note: The
result data type of a LEFT function is a LONG
VARCHAR. If you use LEFT in a SELECT
INTO statement, you must have an Unstructured Data Analytics
option license or use CAST and set LEFT to
the correct data type and size.
Standards and Compatibility