Skip to main content

LTRIM

Functions › Text › Change a string

Removes characters from the start of a string.

Syntax​

LTRIM( <string> [, <characters> ] )

Arguments​

ArgumentDescription
<string>The text to trim.
<characters>Optional. The set of characters to remove. Each character counts on its own. Without it, white space is removed.

Returns​

Text. NULL when any argument is NULL.

Usage notes​

  • Without <characters> it removes white space: spaces, tabs, line breaks.
  • TRIM(LEADING <characters> FROM <string>) is the same call.
  • On large tables the engine runs LTRIM( <string> ) in the data store; with <characters> it runs after the rows are read.

Examples​

Strip leading zeros:

SELECT i.number, LTRIM(i.number, '0') AS number_trimmed FROM data.invoices i
numbernumber_trimmed
000412412
01002010020

See also​

TRIM · RTRIM · LPAD