December 21, 2011 at 4:41 am
Hello,
I was looking for a function to validate a date type variable and came
across the ISDATE() function. However, I was attempting to use this in
conjunction with the newly added (as of SS2008 I believe) DATE data type.
e.g
DECLARE @MyDate DATE = GETDATE();
IF ISDAT(@MyDate) = 1
PRINT 'Date OK';
This resulted in an error which during trial and error appeared to simply
be down to the fact that the newly added data types of DATE and DATETIME2 do
not appear to be supported by the ISDATE() function.
Has Microsoft forgotten about these new date types?
It would appear that they should indeed be supported in order to retain
consistency going forward, or have I missed the point?
Comments or advice welcome.
Steve
December 21, 2011 at 4:56 am
it seems that the ISDATE function doesn't support those data types by design.
https://connect.microsoft.com/sql/feedback/ViewFeedback.aspx?FeedbackID=327335
i got that link from here: http://dhaneenja.blogspot.com/2010/11/isdate-function-doesnt-validate-date.html
December 21, 2011 at 5:12 am
December 21, 2011 at 5:57 am
Thanks for the links.
I read the comments and Microsoft's response and I'd have to say that their stance was pretty weak.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply