Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
5163 มุมมอง

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.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

 

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มิ.ย. 18
5678
0
ธ.ค. 15
3315
1
พ.ย. 22
4755
2
พ.ค. 22
33085
1
ต.ค. 21
2875