基于sql server 2008中的分隔符拆分字符串

时间:2017-02-21 13:43:09

标签: sql-server sql-server-2008 tsql

我想拆分列字符串

这是字符串:

  Final Settlement Of Security Fee /BTS-15-0114/SYED AKHNOKH HUSSAIN

我想在'/'的基础上拆分,我想要这个结果:

   Final Settlement Of Security Fee 
   BTS-15-0114
   SYED AKHNOKH HUSSAIN

我希望获得中间字符串'BTS-15-0114'

1 个答案:

答案 0 :(得分:0)

所有值是否与您发布的格式相同? 以下是样本字符串的示例。

DECLARE @s VARCHAR(max)='Final Settlement Of Security Fee /BTS-15-0114/SYED AKHNOKH HUSSAIN'
SELECT PARSENAME( REPLACE(@s,'/','.'),2)

获得:

BTS-15-0114