SUBSTR

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Extracts a substring from a string.

Syntax 

1substr(<string>, <start> [, count])

Arguments 

Required 

  • <string>: The source string.
  • <start>: The starting position (1-based).

Optional 

  • count: The number of characters to extract.

Returns 

Returns a text value containing the extracted substring.

Considerations 

  • Same as substring(string from start for count) but with comma-separated arguments.
  • Position indexing is 1-based.

Examples 

Extract Substring 

Extract two characters starting at position three.

1SELECT substr('alphabet', 3, 2) AS result;

Returns 'ph'.

Related Documentation 

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