Conversion of varchar to datetime

  • convert(datetime, substring(replace(MANUFACTURED_DATE,'/',''),5,2) +

    substring(replace(MANUFACTURED_DATE,'/',''),3,2) + substring(replace(MANUFACTURED_DATE,'/',''),1,2),112)

    That's just so unnecessary - read the Books online entry for convert. (tip: highlight the word convert in your query in management studio and press F1 key)

    just use convert(datetime,MANUFACTURED_DATE,3) to convert 2 digit year UK format (dd/mm/yy) dates or convert(datetime,MANUFACTURED_DATE,103) to convert 4 digit year UK format (dd/mm/yyyy) dates

Viewing post 16 (of 15 total)

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