Saturday, 16 April 2016

How to validate the date-time in SQL server ?

TO validate the date-time in SQL server,use the following syntax.

Syntax:

ISDATE(Expression)

Return Type:

INT

Example:

Select ISDATE('2016-04-16 12:20:51.550')

Output :

1

SELECT ISDATE('16/04/2016')

Output:

0

Explanation:

ISDATE function will return 1 if the expression is a valid date,else it will return 0.

No comments:

Post a Comment