Convert DD-Mon-YYYY to DD/MM/YYYY

  • Hi experts,

    I have a table called temp in which i have date columns as dt_of_birth [varchar](15),dt_of_joining [varchar] (15).The dates are already stored in the format as DD-Mon-YYYY. Its the employees records

    Now i have to convert these dates as datetime and store it another table employees as DD/MM/YYYY.

    How do i fetch these dates into a query and convert and store it in the other table?

    Thanks in advance...

  • This should get you what you are looking for. I don't know if there is a better way (I'm sure there is tho) but this seems to work OK for me.

    view sourceprint?

    1

    SELECT replace(convert(varchar(50),scheduleTime,106),' ','-') as scheduleTime

  • The date which i give as '10-Aug-2010' is converted and stored in the table as '2010-08-10'

    but i want the date to be stored as '10/08/2010'

    I tried with your it does the conversion but i wanted in this format...

    Please help

  • In this case u may refer this link to solve ur query

    [/url]

  • Posting the same question multiple times doesn't help you get to the right answer, it just fragments the responses you get.

    You don't store dates in SQL Server formatted as anything. That's a display function. Date/time values are stored as decimal values. Do a search of the BOL for dates, and the CONVERT and CAST functions.

    Don't store dates as strings!

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

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