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

前端 未结 21 2341
不思量自难忘°
不思量自难忘° 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 10:00

    Try this,

    DECLARE @name NVARCHAR(MAX) SET @name='xxxxTHAMIZHMANI****'SELECT Substring(@name, 5, (len(@name)-8)) as UserNames
    

    And the output will be like, THAMIZHMANI

提交回复
热议问题