---
schema_version: "1"
id: 256cf358782984a80da4b215df6ed404e38eb560b9087b5806fe2803487a99f3
title: REPLACE
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/string-func/replace.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/replace.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: bede5adcde6637f75a570e56db1496ccf01420deb8e530ae0e7bf6c3203c6aab
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `REPLACE`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Replaces all occurrences of a substring with another substring.

## Syntax

```sql
replace(<string>, <from>, <to>)
```

## Arguments

### Required

- `<string>`: The source string.
- `<from>`: The substring to find.
- `<to>`: The replacement substring.

## Returns

Returns a text value with all occurrences replaced.

## Considerations

- Replaces _all_ occurrences, not just the first.
- Replacement is case-sensitive.

## Examples

### Replace Substring

Replace all occurrences of a substring.

```sql
SELECT replace('abcdefabcdef', 'cd', 'XX') AS result;
```

Returns `'abXXefabXXef'`.

## Related Documentation

- [String Types](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/string.md)
