String Concatenation Operator (||)

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Concatenates two strings or a string and a non-string value, returning NULL if either operand is NULL.

Syntax

<string> || <right_value>

Arguments

Required

  • <left_string>: The first string to concatenate.
  • <right_value>: The second value to concatenate.

Returns

Returns a text value that contains the concatenated strings, or NULL if either operand is NULL.

Considerations

  • NULL arguments are NOT ignored. If either operand is NULL, the result is NULL.
  • This differs from the concat function, which ignores NULL arguments.

Examples

Basic Concatenation

Concatenate two string literals.

SELECT 'Hy' || 'per' AS result;

Returns 'Hyper'.

Concatenation with NULL

Demonstrate NULL handling.

SELECT 'Hy' || NULL AS result;

Returns NULL because one operand is NULL.

String with Integer

Concatenate a string with a number.

SELECT 'Value: ' || 42 AS result;

Returns 'Value: 42'.

Related Documentation