与标题一样,我想在两个相同的符号之间找到字符串,比如
declare @str varchar(255);
set @str = 'I want to + get + all results + out + between two + plus sign'
所以这里的复杂性是@str
有许多相同的加号,我只想取出字符串all results
。
我应该如何使用T-SQL?
答案 0 :(得分:0)
听起来您想使用Replace。
select replace(@str,'+','')
--I want to get all results out between two plus sign
如果每个+符号前后都有空格而你想清理空格,请在+符号后加一个空格
select replace(@str,'+ ','')
--I want to get all results out between two plus sign