Limitation-ISDATE-SQL-Server

Limitation of ISDATE() Function in Sql Server

Limitation of ISDATE() Function in Sql Server

Hey folks till now we have discussed Performance improvement of cursor SQL ServerUser defined functions in sqlKill Processes in sql server 2008, View in sql default constraint in sql , Remove Cross duplicate rows in SQLRecursive SQL Query , Recursive SQL Query-2STUFF and CONCAT in SQLRANK in SQL server , Difference between temporary table and table variable in sql serverUNIQUEIDENTIFIER in SQL ServerRAW Mode with FOR XML , AUTO Mode with FOR XMLEXPLICIT Mode with FOR XML , PATH Mode with FOR XMLOUTPUT Clause in SQL ServerDifference between delete and truncate in sql server etc.

 

Today we will look into Limitation of ISDATE() function in Sql server.

ISDATE() function is used to check whether date is valid or not. If date is valid, this function will return 1 else return 0.

Let’s try to understand what is the Limitation of ISDATE() function in Sql Server using examples:

SELECT ISDATE('2999-04-30') IsValidDate   -- 1
SELECT ISDATE('1021-04-30') IsValidDate   -- 0


-- Result will be VALID
IF ISDATE('2009-05-12 10:19:41.177') = 1  
    SELECT 'VALID';  
ELSE  
    SELECT 'INVALID';
    
-- Result will be INVALID    
IF ISDATE('1009-03-2 10:19:41.177') = 1  
    SELECT 'VALID';  
ELSE  
    SELECT 'INVALID';

 

Note: When we are using four digit format in yyyy format, it supports only year 1582 to 9999.

 

Leave a Reply