简体   繁体   中英

RTRIM from replace

I have used a replace statement to I have @@@ after the name of the customer MR@BOB@REED@@@@@@@@@@@@@@@@@@@@@@@

I now want to get rid of the @ after reed .

I tried:

select RTRIM(Name2,'@')

But I get the error

The rtrim function requires 1 argument(s).

RTRIM removes trailing spaces.

You probably want LEFT or SUBSTRING

eg

select left('@mr@bob@reed@@@@@@@', charindex('@@','@mr@bob@reed@@@@@@@'))
select substring(Name2,0,charindex('@@',Name2)) from table

在上面的查询中,'Name2'是列的名称,table是包含该列的'table'的名称。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM