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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

visual studio - Installing Packages through Nuget - "Central Directory corrupt" -