I am running a SQL Statement against imported data from Excel Files.
In this SQL I am checking if the users have entered dates properly by using IsDate function. Since this is a raw data that hasn't been converted yet, all dates are stored in a varchar data type field.
In some circumstances IsDate returns 1 (valid date) when there is clearly an incorrect date format entered by the user.
For Example:
07/001/2012
2012-07-002
007/002/2012
Any Suggestions on how to handle this problem?
SELECT *
FROM tblImport
WHERE (ISDATE(dt) = 0
AND (dt is not null AND dt <> ''))
Thanks!
p.s. Smacking users' did not help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…