convert(varchar,date, 102) code example
Example 1: sql server convert string to date
Cast( '2011-07-07' as date ) as convertedDate
Example 2: sql convert date to string yyyy-mm-dd
select CONVERT(char(10), GetDate(),126)
/* 2020-12-23 */
Cast( '2011-07-07' as date ) as convertedDate
select CONVERT(char(10), GetDate(),126)
/* 2020-12-23 */