Returns a specified number of characters from the beginning of a string.
Parameter |
Description |
---|---|
string-expression |
The string. |
numeric-expression |
The number of characters to return. |
LONG VARCHAR
LONG NVARCHAR
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.
The following statement returns the value “choco”:
SELECT LEFT( 'chocolate', 5 ) FROM iq_dummy
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.
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.