- Column data type is – date (SQL Server 2008)
- Error,
Argument data type date is invalid for argument 1 of isdate function.
Then I have created some sample T-SQL scripts and check the issue.
USE tempdb
GO
DECLARE @smalldatetime smalldatetime
SELECT @smalldatetime='01/01/2010'
SELECT ISDATE(@smalldatetime);
GO
DECLARE @date date
SELECT @date='01/01/2010'
SELECT ISDATE(@date); --Error
GO
DECLARE @datetime datetime
SELECT @datetime='01/01/2010'
SELECT ISDATE(@datetime);
GO
DECLARE @datetime2 datetime2
SELECT @datetime2='01/01/2010'
SELECT ISDATE(@datetime2); --Error
GO
Finally I realize the problem ISDATE function, only working datetime, smalldatetime data types. Funny thing is Microsoft did not update the ISDATE () function to support this data types. Even it’s not supported SQL SERVER 2008 R2. Simply it doesn’t validate “date” data type and “datetime2” data type. After checking details for this issue Microsoft promised to consider this in there next release (I didn’t check this issue using SQL Server new CTP1 release (”Denali”))