SQL: Use TRY_CAST instead of ISNUMERIC and ISDATE
Like most developers, I often need to check if a string value is a valid number or a valid date (or datetime). In T-SQL, the functions provided for this are ISNUMERIC and ISDATE. These are pretty generic functions though, and I almost never use them now. I believe you’re now much better off using TRY_CAST instead.
“Numeric” is a fairly vague concept. Which type of number are we checking for?
2021-02-23