---
schema_version: "1"
id: 9700f56c664bcc0329509fffeb8b9facc4bf028fe39cac9e3c8e540caba425bf
title: BTRIM
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/btrim.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/btrim.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: e3482d6ddf5d37b7479ef9d78754266606ae4a5c630bab068f1d063009ed8f9c
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `BTRIM`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Removes specified characters from both the start and end of a string.

## Syntax

```sql
btrim(<string> [, characters])
```

## Arguments

### Required

- `<string>`: The string to trim.

### Optional

- `characters`: The characters to remove. Defaults to the space character.

## Returns

Returns a text string with specified characters removed from both ends.

## Considerations

- Removes individual characters from the set, not the string as a pattern.
- Continues removing until it encounters a character not in the set.

## Examples

### Trim Characters

Remove specified characters from both ends.

```sql
SELECT btrim('xyxtrimyyx', 'xyz') AS result;
```

Returns `'trim'`.

## Related Documentation

- [String Types](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/string.md)
