Product Documentation

SQL Reference Guide

Previous Topic

Next Topic

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 type fixed or variable length character type.
  • 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.

TOCIndex