Reputation: 35
I want date to be displayed as yyyy-mm-dd. The value in the table for date is dd/mm/yyyy. I have run the query
select CONVERT(DATE, FORMDATE, 103) from UPDATELOG
and i got error "Conversion failed when converting date and/or time from character string". Anyone can help me with this?
Upvotes: 0
Views: 87
Reputation: 1269483
This certainly looks like SQL Server. So, use try_convert()
instead:
select TRY_CONVERT(DATE, FORMDATE, 103)
from UPDATELOG ;
To get the values that fail, use:
select FORMDATE
from UPDATELOG
where TRY_CONVERT(DATE, FORMDATE, 103) is null
Upvotes: 1