# `POSITION`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Returns the location of a substring within a string.

## Syntax

```sql
position(<substring> in <string> [, start => s] [, occurrence => n])
```

## Arguments

### Required

- `<substring>`: The substring to search for.
- `<string>`: The string to search within.

### Optional

- `start`: The position to start searching from.
- `occurrence`: Which occurrence to find (nth occurrence).

## Returns

Returns an integer that represents the 1-based position of the substring, or `0` if not found.

## Examples

### Find Substring Position

Locate a substring within a string.

```sql
SELECT position('om' in 'Thomas') AS result;
```

Returns `3`, indicating 'om' starts at position 3.

### Find Substring Starting From Position

Locate the second occurrence of a substring within a string starting from position 16.

```sql
SELECT position('sea' in 'Sally sells sea shells by the sea shore, how many sea shells did she sell?')
```

Returns `51`, indicating that the second 'sea' after position 16 starts at position 51.

## Related Documentation

- [String Types](/docs/data/data-cloud-query-guide/references/dc-sql-reference/string.md)
