SQL Server TRIM character

前端 未结 17 2161
感情败类
感情败类 2020-12-09 17:11

I have the following string: \'BOB*\', how do I trim the * so it shows up as \'BOB\'

I tried the RTRIM(\'BOB*\',\'*\') but does not work as says needs only 1 paramet

17条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 17:38

    Solution for one char parameter:

    rtrim('0000100','0') -> select left('0000100',len(rtrim(replace('0000100','0',' '))))

    ltrim('0000100','0') -> select right('0000100',len(replace(ltrim(replace('0000100','0',' ')),' ','.')))

提交回复
热议问题