I have a varchar
column where some values are in mm/dd/yyyy
format and some are in yyyymmdd
.
I want to convert all mm/dd/yyyy
dates into the yyyymmdd
format. What is the best way to do this? Thanks
Table is Employees
and column is DOB
Assuming your "date" column is not actually a date.
Select convert(varchar(8),cast('12/24/2016' as date),112)
or
Select format(cast('12/24/2016' as date),'yyyyMMdd')
Returns
20161224