# Type conversions

Convert values explicitly and handle nulls.

Source: https://particledb.ai/sql/casting/

Convert values explicitly and handle nulls.

## Example

```sql
SELECT CAST('42' AS BIGINT) AS value;
SELECT CAST(42 AS TEXT) AS label;
SELECT CAST(NULL AS BIGINT) AS missing;
```

## Behavior

A cast can fail if the input cannot be represented by the destination type. Validate untrusted input and handle conversion errors instead of relying on silent truncation. SQL NULL remains NULL when cast.

## Related

[SQL reference](/sql/overview/) · [Application guide](/guides/relational-data/) · [Troubleshooting](/guides/troubleshooting/)
