What is the best way to remove all spaces from a string in SQL Server 2008?
LTRIM(RTRIM(\' a b \'))
would remove all spaces at the right and left of th
I had this issue today and replace / trim did the trick..see below.
update table_foo
set column_bar = REPLACE(LTRIM(RTRIM(column_bar)), ' ', '')
before and after :
old-bad: column_bar | New-fixed: column_bar
' xyz ' | 'xyz'
' xyz ' | 'xyz'
' xyz ' | 'xyz'
' xyz ' | 'xyz'
' xyz ' | 'xyz'
' xyz ' | 'xyz'