Question: 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`

Answer: 
try this....

```
SELECT FORMAT(CAST(DOB AS DATE),'yyyyMMdd') FROM Employees;

```
In SQL Server, you can do:

```
select coalesce(format(try_convert(date, col, 112), 'yyyyMMdd'), col)

```

This attempts the conversion, keeping the previous value if available.

Note: I hope you learned a lesson about storing dates as dates and not strings.