Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
5415 Prikazi

Hi Friends,

How to split a character which is separated by (:) operator like OUT/1234: SO/14-15/345.I need output as SO/14-15/345 by only using sql query.Please help me in this situation.Thanks in advance.

Avatar
Opusti
Best Answer

select substring(column_name, position(':' in column_name)+1, length(column_name)) from table_name 

 

Avatar
Opusti
Best Answer

Hello vadivel,

Try this query.

select *,

substring(dat,1,charindex('-',dat)-1) as Section,

substring(dat,charindex('-',dat)+1,charindex('-',dat)-1) as TownShip,

reverse(substring(reverse(dat),0,charindex('-',reverse(dat)))) as myRange

from myTable;



I hope it's work.

Thank you.


Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
2
jun. 18
5900
0
dec. 15
3484
1
nov. 22
5563
2
maj 22
33736
1
okt. 21
3240