---
schema_version: "1"
id: 75bb9342c00d3d47558267e2a07a5c90fc8014177008cbbcf3b0ee202bf7a9ed
title: RIGHT
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/right.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/right.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 222b5a765742437b59b6939e9d57556bc92f08cb973c1d37db3d5651c1cd28d1
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `RIGHT`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the last _n_ characters from a string.

## Syntax

```sql
right(<string>, <n>)
```

## Arguments

### Required

- `<string>`: The source string.
- `<n>`: The number of characters to return. When negative, returns all but the first |_n_| characters.

## Returns

Returns a text value that contains the rightmost characters.

## Considerations

- If <n> exceeds the length of the string, returns the entire string.

## Examples

### Get Last Characters

Extract the last two characters.

```sql
SELECT right('abcde', 2) AS result;
```

Returns `'de'`.

## Related Documentation

- [String Types](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/string.md)
