SQL Flow Field Guide

TRY_CONVERT

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

type conversion

What changes

Input
an expression and target type (and culture/style)
Output or change
converted value (TRY_ variants return NULL on failure)
Return type
Returns a value cast to the specified data type if the cast succeeds; otherwise, returns NULL.

Syntax at a glance

TRY_CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

Work example

Convert source text while returning null for malformed values instead of stopping the batch.

Use an explicit style for date strings and track rows where the result is null.

Check your work TRY_CONVERT has the same disallowed-conversion boundary as CONVERT and can take a style.

Practice SQL

Open in SQL Flow
SELECT TRY_CONVERT(date, '2026-04-05', 23) AS parsed_date;

Open Microsoft Learn for full syntax, permissions, and details for your version.