SQLTeam.com | Weblogs | Forums

Convert Date


#1

I have a date in a field on a table 20170101 and need to convert it to 2017-01-01. What is the easiest way to do this?

The field is not a date field

Thanks


#2

STUFF(STUFF(date_column, 7, 0, '-'), 5, 0, '-')


#3

Thanks Scott