Remove Trailing Spaces and Update in Columns in SQL Server

前端 未结 13 1161
抹茶落季
抹茶落季 2020-12-22 20:42

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

13条回答
  •  北荒
    北荒 (楼主)
    2020-12-22 21:10

    Well, it depends on which version of SQL Server you are using.

    In SQL Server 2008 r2, 2012 And 2014 you can simply use TRIM(CompanyName)

    SQL Server TRIM Function

    In other versions you have to use set CompanyName = LTRIM(RTRIM(CompanyName))

提交回复
热议问题