Hello Friend i was doing some exercise on date time function and face a problem please Help me to solved out this problem
my query is
SET LANGUAGE us_english;
SET DATEFORMAT mdy;
SELECT ISDATE('03/18/2010') AS [ISDATE] UNION ALL
SELECT ISDATE('03-15-2010') UNION ALL
SELECT ISDATE('03.15.2010') UNION ALL
SELECT ISDATE('03/2010/15')
SET DATEFORMAT mdy;
SELECT ISDATE('03/18/2010') AS [ISDATE] UNION ALL
SELECT ISDATE('03-15-2010') UNION ALL
SELECT ISDATE('03.15.2010') UNION ALL
SELECT ISDATE('03/2010/15')
when we execute this query it will return
1
1
1
1
Now my question is last select statement is
SELECT ISDATE('03/2010/15')
format of date is MYD. But i define the format of date MDY
So according this server should be return 0 instead of 1 but it doesn't return 0.
So Please explain me what is Reason behind it...........
Thanks for reading my Question..........

Manoj BhoirPosted Jul 2, 2015, 8:04 AM
The return value of ISDATE depends on the settings set by SET DATEFORMAT, SET LANGUAGE and default language option.
So if the given string not applies to the set dateformat it also check the default language option which allows dates in a format like MM/yyyy/dd.
Pankaj Kumar ChoudharyPosted Jul 2, 2015, 8:27 AM
Pankaj Kumar ChoudharyPosted Jul 2, 2015, 7:56 AM
SELECT ISDATE('04/2008/4'); --Returns 1. // Why this statement return 1 while DATEFORMAT of date is mdy and we are providing a date of format MYD
SELECT ISDATE('04/15/2008'); --Returns 1.
Upendra Pratap ShahiPosted Jul 2, 2015, 7:38 AM
Pankaj Kumar ChoudharyPosted Jul 2, 2015, 7:30 AM
SELECT ISDATE('2008/15/04'); --Returns 0.
SELECT ISDATE('2008/15/04'); --Returns 1.
Upendra Pratap ShahiPosted Jul 2, 2015, 7:22 AM
Upendra Pratap ShahiPosted Jul 2, 2015, 7:18 AM