Problem while retrieving bad data

  • Hi

    I have a table say Orders with a column Orderdate. I have to base my query on OrderDate. The problem is that Orderdate is a char column and contains junk characters.

    Hence my query

    select * from Orders  where convert(datetime,Orderdate)>getdate() fails miserably.

    The rows which contain junk characters for Orderdate need to be excluded.

    any pointers would be greatly appreciated.

    Rgds

    Shyam

     

     

  • Try the following:

    select * from Orders 

    where convert(datetime, isdate(Orderdate)) < getdate() and isdate(Orderdate) = 1

    Michael.

  • Thanx very much

    It worked

    U dont know how grateful I am

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply