Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Sample pattern is as shown in example, i want to separate values before and after : (colon)

Sample string pattern: 23:4,13:6^12:1^15:3^45:6,99:2,64:1^.....^

Note: between caps number commas may vary for e.g

 23:4,13:6^  - 1comma
 ^12:1^   - no comma
 ^45:6,99:2,64:1^  - 2 commas 

Expected output:

 ColumnA    ColumnB
 ------------------
    23        4
    13        6
    12        1
    15        3
    45        6
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
226 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can simply replace the delimiter characters with spaces.

SELECT REPLACE(REPLACE(REPLACE(colname, ',', ' '), ':', ' '), '^', ' ')
FROM yourTable

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...