ISDATE
ISDATE( expression )
Section titled “ISDATE( expression )”- expression: A valid character string representation of a date or datetime value. This input is checked by the `ISDATE()` function to determine if it can be converted into a valid date or datetime data type in SQL Server.
Example
Section titled “Example”DECLARE @date AS VARCHAR(30);SET @date = '2021-08-15';SELECT ISDATE(@date) AS 'Result';Output
Section titled “Output”Result----------1Explanation
Section titled “Explanation”In the example provided, ISDATE function is used to check whether a string is a valid date. ‘2021-08-15’ is a valid date, thus output returns 1 (true). If the input is not a valid date, ISDATE function will return 0 (false).