sql - Quicker way of converting from string with European date format to ISO dateformat -


i wanted ask if there quicker way of doing this:

convert(nvarchar(10), convert(date, '18.02.2016', 104), 112) 

the following produces error:

convert(date, '18.02.2016', 112) 

the entered string isn't style 112

sql server 2012 used.

the first expression correct method, consider using char(10) instead.

this alternative method using format more flexible allowing other standard formats. format introduced in sqlserver 2012.

select format(convert(date, '18.02.2016', 104), 'yyyymmdd') 

Comments