Welcome to Microsoft T-SQL Q&A Forum!
Here I provide a combination of convert method and replace, you may be able to learn more about date format conversion.Of course, as violel said, if use SQL Server 2012+ or later,
you can use FORMAT(value, format [, culture ]).
select CONVERT(VARCHAR(11),REPLACE(CONVERT(VARCHAR(11),datetime, 106), ' ', '-')) from #t1
Best regards,
Bert Zhou
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.