Subject Cast As Date issue
Author Joe Martinez
Ok. I have a varchar field called SPARE1 that I let the users use for
whatever they want.

One of my customers is using it as a date field, and wants to do a valid
date comparison on this field. So, I thought of:

select * from customers
where cast (spare1 as date) > '1/1/2004'

The problem is that they don't have EVERY record with a valid date in there
(like if they leave some of them blank), then the query fails with
"conversion error from string '' ".

Is there any way to make this work correctly if there are nulls/blanks, or
even other random stuff in the field?

-Joe