Remove line breaks and spaces from Table field

By | 24 October, 2012

Had an issue with a huge table of email address not really compliant. Some had trailing/ending spaces, others even line breaks. To fix the line breaks, this worked:

 

update emails_table set email = replace(email, ‘\n’, ”)

 

To remove trailing/ending spaces, i used this:

 

update emails_table set email=trim(email)

 

Go and be happy.