0

I have used the Query:

    update Table
    set Seg = RTRIM(Seg)

This still doesn't remove the extra spaces at the end? I really need to remove this as I am doing vlookups in Excel and it is causing problems.

The datatype of Seg column is (nchar(10), null)

Any help is appreciated.

Sorath
  • 543
  • 3
  • 10
  • 32

2 Answers2

1

You can right-trim an NCHAR(X) column all you want, values will always be the same length. Namely: X. The value will always be padded with spaces, so RTRIM is basically a no-op on a fixed width character column.

Also note that in string comparisons, trailing spaces are ignored.

TT.
  • 15,774
  • 6
  • 47
  • 88
-1

To trim spaces from the end you should use

UPDATE TableName SET ColumnName = RTRIM(ColumnName)

if you want to trim all spaces then use this

UPDATE TableName SET ColumnName = LTRIM(RTRIM(ColumnName))