I have a table in a SQL Server 2008 database. This table has a nvarchar(256) column called ‘Name’. Unfortunately, the values in this field have extra spaces included. For instance the name ‘Bill’ is actually stored as ‘Bill ‘ in the table.
I want to update all of the records in this table to remove the extra spaces. However, I was surprised to learn that SQL does not have a TRIM function.
How do I update all of the records at once to remove the extra spaces?
Thank you!
You do have an
RTRIMand anLTRIMfunction. You can combine them to get the trim function you want.