跳至內容
選單
此問題已被標幟
2 回覆
5423 瀏覽次數

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.


頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
2
6月 18
5906
0
12月 15
3487
1
11月 22
5574
2
5月 22
33754
1
10月 21
3251