Remove the last character in a string in T-SQL?

前端 未结 21 2344
不思量自难忘°
不思量自难忘° 2020-12-07 09:22

How do I remove the last character in a string in T-SQL?

For example:

\'TEST STRING\'

to return:

\'TES         


        
21条回答
  •  天命终不由人
    2020-12-07 09:55

    This is quite late, but interestingly never mentioned yet.

    select stuff(x,len(x),1,'')
    

    ie:

    take a string x
    go to its last character
    remove one character
    add nothing
    

提交回复
热议问题