The SQL ISDATE function is a built-in function in Microsoft SQL Server that is used to determine whether an expression is a valid date or not. It returns 1 if the expression is a valid date, and 0 if it is not.


The syntax for the ISDATE function is as follows:

ISDATE ( expression )

Where expression is the value that is being checked for being a valid date. The expression can be a string or a datetime value.


For example, the following SQL statement checks whether the string ‘2023-04-27’ is a valid date:

SELECT ISDATE('2023-04-27');

This statement will return 1, since ‘2023-04-27’ is a valid date.

Another example is checking whether the string ‘2023-04-31’ is a valid date:

SELECT ISDATE('2023-04-31');

This statement will return 0, since ‘2023-04-31’ is not a valid date (April has only 30 days).

Note that the ISDATE function is only available in Microsoft SQL Server. In other database management systems, such as MySQL or Oracle, there are other functions that can be used to check for valid dates.