Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
5419 Widoki

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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

 

Awatar
Odrzuć
Najlepsza odpowiedź

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.


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
cze 18
5904
0
gru 15
3485
1
lis 22
5572
2
maj 22
33750
1
paź 21
3250