Returns the leftmost count of characters of string_exp.

Syntax

LEFT ( string_exp , count )

Notes

  • string_exp can be fixed‑length or variable‑length CHARACTER data types.
  • count can be INTEGER, SMALLINT, or TINYINT data types.
  • If any of the arguments of the expression evaluate to NULL, the result is NULL.
  • If the count is negative, the result evaluates to NULL.
  • The string_exp and the result can contain multi‑byte characters. The function returns the number of characters.

Example

The following example shows how to use the LEFT function:

SELECT LEFT(last_name,4) FROM  customer WHERE last_name = 'Goldman';
 LEFT(LAST_NAME),4)
------------------
Gold
 1 record selected

Compatibility

ODBC compatible