String Functions and Operators
Data 360 Query Guide, mirrored from developer.salesforce.com: **Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API
markdownreferencev1GVCC-G2HRguide: data-cloud-query-guidestage: referencetrust: officialsource: developer.salesforce.comservice: data360interface: sqlString Functions and OperatorsData 360Data CloudData 360 Query Guide
Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/string-func.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.
String Functions and Operators
Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Functions and operators for examining and manipulating string values. Use string functions to:
- Transform case by converting strings to uppercase, lowercase, or title case.
- Extract and search substrings, find positions, and split text.
- Pad and trim strings to adjust length and remove unwanted characters.
- Encode and hash data for storage or security purposes.
- Character and byte length: Functions like
char_lengthcount characters, butoctet_lengthcounts bytes. This distinction matters for multi-byte UTF-8 characters. - 1-based indexing: String positions start at 1, not 0.
- NULL handling: The
||operator returns NULL if either operand is NULL. Useconcatto ignore NULL values.
For more information about supported types, see String Types.
Combine strings and values:
- CONCAT — Concatenate multiple values, ignoring NULLs.
- String Concatenation Operator (||) — Concatenate two strings or a string and a non-string value (
NULL-sensitive).
Measure string size:
- BIT_LENGTH — Get the number of bits in a string.
- CHAR_LENGTH / CHARACTER_LENGTH — Count the number of characters in a string.
- LENGTH — Count the number of characters in a string.
- OCTET_LENGTH — Get the number of bytes in a string.
Transform string case:
- INITCAP — Capitalize the first letter of each word.
- LOWER — Convert to lowercase.
- UPPER — Convert to uppercase.
Extract and locate substrings:
- LEFT — Get the first _n_ characters.
- OVERLAY — Replace a substring at a position.
- POSITION — Find the location of a substring.
- RIGHT — Get the last _n_ characters.
- SPLIT — Split a string into an array by delimiter.
- SPLIT_PART — Split a string on delimiter and return a field.
- STRPOS — Find substring location (alternative syntax).
- SUBSTR — Extract a substring (alternative syntax).
- SUBSTRING — Extract a substring by position and length.
Adjust string length:
- BTRIM — Remove characters from both ends.
- LPAD — Pad a string on the left.
- LTRIM — Remove characters from the start.
- RPAD — Pad a string on the right.
- RTRIM — Remove characters from the end.
- SPACE — Generate a string of spaces.
- TRIM — Remove characters from start, end, or both.
Transform and manipulate strings:
- REPEAT — Repeat a string multiple times.
- REPLACE — Replace all occurrences of a substring.
- REVERSE — Reverse the characters in a string.
Check for substrings and string boundaries:
- CONTAINS / ICONTAINS — Check whether a string contains a substring.
- ENDS_WITH — Check whether a string ends with a suffix.
- STARTS_WITH — Check whether a string starts with a prefix.
Convert between characters and codes:
Encode data and compute hashes:
- DECODE — Decode text to binary data.
- ENCODE — Encode binary data to text (base64, hex, escape).
- MD5 — Compute the MD5 hash for data.
- SHA256 — Compute the SHA-256 hash for data.
- TO_BASE64 — Convert data to base64.
- TO_HEX — Convert data to hexadecimal.
Prepare strings for SQL statements:
- QUOTE_IDENT — Quote a string as an SQL identifier.
- QUOTE_LITERAL — Quote a string as an SQL literal.
Normalize and clean user input.
Extract components from structured strings.
Format data for display.
Find and modify text patterns.