• Jeff Moden (5/14/2013)


    sqlfriends (5/14/2013)


    I would like to convert a varchar column to datetime.

    The varchar column are supposed are be like a date : 2013-05-12

    But there may be a wrong date due to user error: like this one 0210-05-12.How can I use a statement to convert all them to datetime and if it is a invalid one like above, make it null.

    Thanks

    Wow! Deja vu! I believe a couple of other folks have asked this question with that very same bad date. You folks all taking the same course? 😉

    Are you sure it's other folks? May be it's the same one having groundhog day? :hehe:

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]