Good day everyone!
I am using the T-SQL ISDATE() function with a date column as argument to filter out bad dates; the problem is the ISDATE function will return zero when it comes across a NULL value.
So with the example below; valid data in the table will be left out of the result set if there is a null for their dates. How can I remedy this so that I can get valid dates but also retrieve records with no dates? I need the records with no dates as well, I only need to remove those with bad dates, example, incomplete dates or dates missing characters.
Example:
SELECT * FROM EXAMPLE WHERE ISDATE(MAYDATE) <> 0
Thanks my friends!
You could either use the ISNULL function, to replace the NULL value with a valid date value that is just used by the ISDATE function. Here are two examples:
Or just check to see if the the value is NULL