[sqlite] Parsing the contents of a field

2016-01-17 Thread R Smith
On 2016/01/16 4:53 PM, Simon Slavin wrote: > On 16 Jan 2016, at 2:31pm, R Smith wrote: > >> There is of course no SQL function to do this, but thanks to CTE we can >> achieve it easily (though not extremely efficiently). > I thought that WITH could be used only for SELECT statements. > > Oh

[sqlite] Parsing the contents of a field

2016-01-17 Thread Simon Slavin
On 17 Jan 2016, at 12:27am, R Smith wrote: > I quote from the documentation at: https://www.sqlite.org/lang_with.html > > "All common table expressions (ordinary and recursive) are created by > prepending a WITH clause in front of a SELECT, INSERT, DELETE, or UPDATE > statement. A single

[sqlite] Parsing the contents of a field

2016-01-16 Thread R Smith
On 2016/01/16 7:02 AM, audio muze wrote: >> What do you mean by "parse" ? Just to separate a string into its delimited >> substrings ? Since SQLite has no array or list variable-type there's no way >> to do that because there's no way to return the result. Can you not just >> return the

[sqlite] Parsing the contents of a field

2016-01-16 Thread Simon Slavin
On 16 Jan 2016, at 2:31pm, R Smith wrote: > There is of course no SQL function to do this, but thanks to CTE we can > achieve it easily (though not extremely efficiently). I thought that WITH could be used only for SELECT statements. Oh wait, you want to use the WITH statement as a

[sqlite] Parsing the contents of a field

2016-01-16 Thread Simon Slavin
On 16 Jan 2016, at 5:02am, audio muze wrote: > The fields in question have content as follows: > string1\\string2\\string3\\...\\stringx > > I want to write every record's entries to a table with each element > being a separate record i.e. This would require a different number of INSERT

[sqlite] Parsing the contents of a field

2016-01-16 Thread audio muze
> What do you mean by "parse" ? Just to separate a string into its delimited > substrings ? Since SQLite has no array or list variable-type there's no way > to do that because there's no way to return the result. Can you not just > return the value retrieved from the table and parse it in

[sqlite] Parsing the contents of a field

2016-01-13 Thread Gabor Grothendieck
If it's OK to use the sqlite3 cmd line shell then try this: -- create test input table X create table X (what text); insert into X values ('abc,def'); -- write X to a file .output mydata.csv select * from X; .output stdout -- read it back in to parse it create table Y (a text, b text); .mode

[sqlite] Parsing the contents of a field

2016-01-13 Thread Igor Korot
Hi, On Wed, Jan 13, 2016 at 10:05 AM, Jim Morris wrote: > Might be doable with a recursive CTE > > On 1/13/2016 1:22 AM, Bart Smissaert wrote: >> >> It probably can be done with just SQLite's built-in text functions such as >> instr and substr, >> although with 20 to 30 items it may get a bit

[sqlite] Parsing the contents of a field

2016-01-13 Thread Don V Nielsen
You will thank yourself by using a scripting language such Ruby, php, or python. Is there a reg ex library for sqlite that could be employed? On Tue, Jan 12, 2016 at 11:42 PM, audio muze wrote: > I have a table of roughly 500k records with a number of fields > containing delimited text that

[sqlite] Parsing the contents of a field

2016-01-13 Thread Bart Smissaert
It probably can be done with just SQLite's built-in text functions such as instr and substr, although with 20 to 30 items it may get a bit messy and complex. RBS On Wed, Jan 13, 2016 at 5:42 AM, audio muze wrote: > I have a table of roughly 500k records with a number of fields > containing

[sqlite] Parsing the contents of a field

2016-01-13 Thread Simon Slavin
On 13 Jan 2016, at 5:42am, audio muze wrote: > The number of delimited entries embedded in a > field can vary from none to as man as 20/30. Is there an addin I can > compile with SQLite that provides the ability to parse a string? What do you mean by "parse" ? Just to separate a string into

[sqlite] Parsing the contents of a field

2016-01-13 Thread audio muze
I have a table of roughly 500k records with a number of fields containing delimited text that needs to be parsed and written to separate tables as a master lists. In order to do this I need to parse the field contents, however, I don't see any functions within SQLite to enable that. The number

[sqlite] Parsing the contents of a field

2016-01-13 Thread Jim Morris
Might be doable with a recursive CTE On 1/13/2016 1:22 AM, Bart Smissaert wrote: > It probably can be done with just SQLite's built-in text functions such as > instr and substr, > although with 20 to 30 items it may get a bit messy and complex. > > RBS > > On Wed, Jan 13, 2016 at 5:42 AM, audio

[sqlite] Parsing the contents of a field

2016-01-13 Thread Edward Lau
the result into another table. Regards. -Original Message- From: audio muze <audiom...@gmail.com> To: sqlite-users Sent: Tue, Jan 12, 2016 9:42 pm Subject: [sqlite] Parsing the contents of a field I have a table of roughly 500k records with a number of fields containing delimite