In SQL Server, an often used function is CAST()
, which converts an expression of one data type to another. But if the cast doesn’t succeed, then it returns an error.
Enter TRY_CAST()
.
The TRY_CAST()
function doesn’t return an error if the cast fails. Instead, it returns NULL
.
There are some occasions however, where it will return an error.
Continue reading