# TRY_CAST() Function

### Description

Attempts to cast a value to a specified data type, returns NULL if unsuccessful

### Syntax

```sql
TRY_CAST(expression AS target_data_type)
```

### Parameters

| Parameter | Description | Data Type | Required |
| --- | --- | --- | --- |
| _expression_ | Column or expression to evaluate | Any | Yes |
| _as\_type_ | Target data type for the conversion | Type name | Yes |

### Example

```sql
SELECT
    TRY_CAST(employee_number AS varchar)
FROM
    rippling.employee.Employee
LIMIT
    5;
```

Source: https://developer.rippling.com/documentation/rippling-platform/transformations/sql-reference/try_cast

> For the complete documentation index, see [llms.txt](https://developer.rippling.com/llms.txt). Public pages have a Markdown version at the same URL with .md added.
