OVERLAY

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Replaces a substring within a string at a specified position.

Syntax

overlay(<string> placing <replacement> from <start> for <count>)

Arguments

Required

  • <string>: The original string to modify.
  • <replacement>: The substring to insert.
  • <start>: The starting position (1-based).
  • <count>: The number of characters to replace.

Returns

Returns a text value with the specified substring replaced.

Examples

Replace Substring

Replace characters within a string.

SELECT overlay('Txxxas' placing 'hom' from 2 for 4) AS result;

Returns 'Thomas' by replacing 4 characters starting at position 2 with 'hom'.

Related Documentation