问题:

 在SQL中
像:1-9-3-2
想得到最后一个“-”后面的字符串?

答案:

 

declare @str varchar(50)
set @str='1-9-3-2'
select REVERSE(SUBSTRING(REVERSE(@str),1,CHARINDEX('-',REVERSE(@str))-1)) 

相关文章:

  • 2021-08-06
  • 2022-12-23
  • 2021-05-29
  • 2021-07-28
  • 2021-07-25
  • 2021-09-16
  • 2021-04-24
猜你喜欢
  • 2021-09-03
  • 2021-10-31
  • 2022-03-06
  • 2022-01-23
  • 2021-04-09
  • 2021-11-09
  • 2022-12-23
相关资源
相似解决方案