sql - Split a string into rows using pure SQLite -


using sqlite, i'd split string in following way.

input string:

c:\users\fidel\desktop\temp 

and have query return these rows:

c:\ c:\users\ c:\users\fidel\ c:\users\fidel\desktop\ c:\users\fidel\desktop\temp 

in other words, i'd split file path constituent paths. there way in pure sqlite?

this possible recursive common table expression:

with recursive split(s, last, rest) (   values('', '', 'c:\users\fidel\desktop\temp')   union   select s || substr(rest, 1, 1),          substr(rest, 1, 1),          substr(rest, 2)   split   rest <> '' ) select s split rest = ''    or last = '\'; 

(you did not ask reasonable way.)


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -