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

# `int` 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

Casts the value `expr` to INTEGER. This function is a synonym for `CAST(expr AS INTEGER)`.

## Syntax

```
int(expr)
```

## Arguments

* `expr`: Any expression which is castable to INTEGER.

## Returns

An INTEGER.

If `expr` is a `STRING` that cannot be parsed as a number, Databricks raises a [CAST\_INVALID\_INPUT](https://docs.databricks.com/aws/en/error-messages/cast-invalid-input-error-class.md) error. If the value overflows the `INTEGER` range, Databricks raises a [CAST\_OVERFLOW](https://docs.databricks.com/aws/en/error-messages/error-classes.md#cast_overflow) error.

## Common error conditions

* [CAST\_INVALID\_INPUT](https://docs.databricks.com/aws/en/error-messages/cast-invalid-input-error-class.md)
* [CAST\_OVERFLOW](https://docs.databricks.com/aws/en/error-messages/error-classes.md#cast_overflow)

## Examples

```sql
> SELECT int(-5.6);
 -5
> SELECT int('5');
 5

> SELECT int('abc');
  Error: CAST_INVALID_INPUT
```

## Related functions

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