I need to convert dt_of_birth [varchar] (15)
which is in the format DD-Mon-YYYY
to DD/MM/YYYY
.
dt_of _birth
is specified in different table and the conversion had to be done and stored in another table which has the same column name as dt_of_birth
.
Here
SELECT convert(datetime, '23/10/2016', 103) -- dd/mm/yyyy
This will work
SELECT CONVERT(CHAR(11), CONVERT(SMALLDATETIME, '27-Jan-2011', 13), 103);
Try this:-
SELECT CONVERT(CHAR(11), CONVERT(SMALLDATETIME, '23-Oct-2016', 13), 103);
103
is for dd/mm/yyyy
format
Check out this link
Try this:-
INSERT INTO SecondTable(Column1)
SELECT CONVERT(VARCHAR(10),CAST(dt_of_birth AS DATETIME),103) FROM FirstTable