APPX Software Library

Chapter 4: SQL Language Elements

4.9.2.42 LEFT function (ODBC compatible)

Syntax

LEFT ( string_exp, count )

Description

The scalar function LEFT returns the leftmost count of characters of string_exp.

Example

SELECT LEFT(name,4)
FROM   customer
WHERE  name = 'Goldman';

LEFT(NAME,4)

Gold
1 record selected

Notes

  • The string_exp can be of the type fixed or variable length CHARACTER.
  • The count can be of the type INTEGER, SMALLINT, BIGINT, or TINYINT.
  • If any of the arguments of the expression evaluates to a null, the result would be null.
  • If the count is negative, the result evaluates to a null.