TRY_PARSE()
TRY_PARSE returns the result of an expression, translated to the requested data type, or NULL if the cast fails.
Signature
TRY_PARSE ( string_value AS data_type [ USING culture ] )Parameters
- string_value — nvarchar(4000) value representing the formatted value to parse into the specified data type.
- data_type — Literal representing the data type requested for the result.
- culture — Optional string that identifies the culture in which *string_value* is formatted.
Examples
SELECT TRY_PARSE ('Jabberwokkie' AS DATETIME2 USING 'en-US') AS Result;NULLSELECT
CASE WHEN TRY_PARSE ('Aragorn' AS DECIMAL USING 'sr-Latn-CS') IS NULL
THEN 'True'
ELSE 'False'
END AS Result;TrueRun against SQL Server 16.0.4265.3 on 2026-09-13. This is the output we got, not the documentation’s.
Available on
- SQL Server 2017 and later
- Azure SQL Database
- Azure Synapse Analytics
- Microsoft Fabric warehouse
- Fabric SQL database
Signature and description adapted from the Microsoft SQL documentation, used under the CC BY 4.0. SQL Server and Azure are trademarks of the Microsoft group of companies. This page is not affiliated with Microsoft.