Reputation: 60811
How do I select all rows except for ones that where I get an error calling CONVERT
on one of the columns?
For example, I am doing this:
SELECT rowid
FROM batchinfo
WHERE CONVERT(DATE, reporttime, 101) between '2010-07-01' and '2010-07-31';
And I am getting errors for some of the values. I have two questions:
Upvotes: 5
Views: 4763
Reputation: 22204
You can use the ISDATE() function to test the values.
SELECT *
FROM MyTable
WHERE ISDATE(MyColumn) != 1
Upvotes: 10
Reputation: 854
I believe you can utilize the IGNORE statement for this, I may be wrong though.
Upvotes: -1