I have trailing spaces in a column in a SQL Server table called Company Name.
All data in this column has trailing spaces.
I want to remove all
If you are using SQL Server (starting with vNext) or Azure SQL Database then you can use the below query.
SELECT TRIM(ColumnName) from TableName;
For other SQL SERVER Database you can use the below query.
SELECT LTRIM(RTRIM(ColumnName)) from TableName
LTRIM - Removes spaces from the left
example: select LTRIM(' test ') as trim = 'test '
RTRIM - Removes spaces from the right
example: select RTRIM(' test ') as trim = ' test'