How TRY_PARSE() Works in SQL Server

In SQL Server, the TRY_PARSE() function returns the result of an expression, translated to the requested data type, or NULL if the conversion fails.

Basically, it works the same as the PARSE() function, except that it returns NULL instead of an error if the cast fails.

Both functions are intended for converting string values to either date/time or number types.

Continue reading