LEFT

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the first n characters from a string.

Syntax 

1left(<string>, <n>)

Arguments 

Required 

  • <string>: The source string.
  • <n>: The number of characters to return. When negative, returns all but the last |n| characters.

Returns 

Returns a text value that contains the leftmost characters.

Considerations 

  • When n is negative, returns all but the last |n| characters.
  • If n exceeds string length, returns the entire string.

Examples 

Get First Characters 

Extract the first two characters.

1SELECT left('abcde', 2) AS result;

Returns 'ab'.

Related Documentation 

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!