Remove Trailing Spaces and Update in Columns in SQL Server

前端 未结 13 1147
抹茶落季
抹茶落季 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 20:53

    SQL Server does not support for Trim() function.

    But you can use LTRIM() to remove leading spaces and RTRIM() to remove trailing spaces.

    can use it as LTRIM(RTRIM(ColumnName)) to remove both.

    update tablename
    set ColumnName= LTRIM(RTRIM(ColumnName))
    

提交回复
热议问题