Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

how to use substring function to get the values

$
0
0

Hello All,

Could you please tell me how to get the value after 'between', before 'and'  i.e., BOKSAM KAND LAMOG  also after 'and' and before '('
want to get the bold values (between, and are case senstive)

for example MatterColumn   has value  "Collapsed Statue: Matured Life # 007812 between BOKSAM KAND LAMOG and Bill APPER SRIM (Goper)"

right now i am doing this once is working and another one is saying issue with length character in substring

rtrim (ltrim (SUBSTRING(MatterColumn,CHARINDEX('between',MatterColumn  COLLATE Latin1_General_CS_AI)+8, ( Charindex(' and ', MatterColumn  COLLATE Latin1_General_CS_AI,CHARINDEX('between',MatterColumn  COLLATE Latin1_General_CS_AI)+8) - CHARINDEX('between',MatterColumn  COLLATE Latin1_General_CS_AI)-8 )  ) )) Part1,

rtrim (ltrim (SUBSTRING(MatterColumn,CHARINDEX(' and ',MatterColumn  COLLATE Latin1_General_CS_AI)+5, ( Charindex(' (', MatterColumn  COLLATE Latin1_General_CS_AI,CHARINDEX(' and ',MatterColumn  COLLATE Latin1_General_CS_AI)+8) - CHARINDEX(' and ',MatterColumn  COLLATE Latin1_General_CS_AI)-5 )  ) )) Part2

please help me

thanks in advance

asitti


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>