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 

1<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.

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

Returns 'Hyper'.

Concatenation with NULL 

Demonstrate NULL handling.

1SELECT 'Hy' || NULL AS result;

Returns NULL because one operand is NULL.

String with Integer 

Concatenate a string with a number.

1SELECT 'Value: ' || 42 AS result;

Returns 'Value: 42'.

Related Documentation 

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