SQLTeam.com | Weblogs | Forums

Stipping out characters


#1

I have a field with a date in it, but it is 2015-06-05

How do i change it to 20150605

Thanks


#2

If its a string field: replace(yourfield,'-','')
If its a date field: convert(varchar(8),yourfield,112)


#3

If this is for display purposes, you should be doing this conversion in the application and not in SQL.