Skip to main content

LEFT() and RIGHT() Functions

Definition LEFT() function extracts a given number of characters from the left side of a supplied character expression.  RIGHT() function extracts a given number of characters from the right side of a

Updated over 2 weeks ago

Definition

LEFT() function extracts a given number of characters from the left side of a supplied character expression. RIGHT() function extracts a given number of characters from the right side of a supplied character expression.

Syntax

LEFT(string, number_of_chars)

RIGHT(string, number_of_chars)

where string is the string to extract from and number_of_chars is the number of characters to extract. If the number exceeds the number of characters in string, it returns string. Both parameters are required.

Example(s)

What to use in Custom SQL field:

  • LEFT([Employee: First Name],5)

  • RIGHT('Hello',4)

Field Outputs:

mceclip0.png

As shown in the output results, the LEFT function starts BEFORE the left-most character of a string and moves to the right, while the RIGHT function starts AFTER the right-most character and moves inwards to the left.

See how LEFT() can be used to:

Did this answer your question?