Skip to Content
Menu
This question has been flagged
2 Replies
5440 Rodiniai

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.

Portretas
Atmesti
Best Answer

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

 

Portretas
Atmesti
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.


Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
2
birž. 18
5918
0
gruod. 15
3492
1
lapkr. 22
5587
2
geg. 22
33782
1
spal. 21
3261