sql - How to convert date stored in nvarchar to date in MMDDYYY format removing dashes (e.g 06122012)? -
i want convert date stored nvarchar
in birth_date
column sql.
for example, have dates in 1999-01-22
format, want convert 01221999
(8 characters) using sql server.
can me please?
i agree @marc_s should using proper data type (date), if have return custom format, can make use of convert
:
select replace(convert(varchar(10), convert(date, birth_date), 101), '/', '')
i suggest it's code smell convert
doesn't have format you're looking for. must therefore massage converted data, in case using replace
remove slashes.
Comments
Post a Comment