Trim spaces in string - LTRIM RTRIM not working

后端 未结 8 1817
你的背包
你的背包 2021-02-03 19:14

I tried this code -

UPDATE Table
SET Name = RTRIM(LTRIM(Name))

Data type of Name is varchar(25)

None of the leading and t

8条回答
  •  故里飘歌
    2021-02-03 20:09

    You can use the HEX method above, or you can also use the ASCII() function to determine the ASCII code of the character in question...

    SELECT ASCII(SUBSTRING('  character string', 1, 1)) 
    SELECT ASCII(SUBSTRING('  character string', 2, 1))
    

    The select only returns 1 value for the character you specify. But it's helpful for determining which ASCII CHAR() value(s) you need to replace.

    -Eric Isaacs

提交回复
热议问题