---
title: find_in_set function
description: Learn the syntax of the find\_in\_set function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/find_in_set
---

# `find_in_set` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns the position of a string within a comma-separated list of strings.

## Syntax

```
find_in_set(searchExpr, sourceExpr)
```

## Arguments

* `searchExpr`: A STRING expression specifying the “word” to be searched.
* `sourceExpr`: A STRING expression with commas separating “words”.

## Returns

An INTEGER.
The resulting position is 1-based and points to the first letter of the match.
If no match is found for `searchExpr` in `sourceExpr` or `searchExpr` contains a comma, 0 is returned.

## Examples

```sql
> SELECT find_in_set('ab','abc,b,ab,c,def');
 3
```

## Related functions

* [`array_contains` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/array_contains.md)
