how to convert varchar to datetime

  • Hi ,

    i have a varchar column 22-nov-09 i want to conert into datetime datatype with 02:15:00 millisec...

    It should be 2009-11-22 02:15:00..

    can anyone help me?

  • Lookup CONVERT in Books Online. That is the best place to start to answer your question.

  • You could also look on Lynns blog. He has some examples there of various datetime operations.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • I have looked every where for this,

    I want datetime to convert into varchar (ex:16-feb-10)

    but i found convert(varchar, columnname , 6) which is converting into 16 feb 10..

    can anyone help?

  • replace(convert(varchar, columnname , 6),' ','-')

    Does this help?

  • Yes it helped ,Thank you

Viewing 6 posts - 1 through 5 (of 5 total)

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