Android Question [CLOSED] SQLite: inserting return characters

TyneBridges

Member
Licensed User
Longtime User
In order to ensure a "clean" import I've removed return characters (line feeds) from my database text entries by replacing them with an unused character. I'm now trying to put them back. The line

OurCursor = G.SQL1.ExecQuery("Update DEntries set Entry = replace(Entry, '}', char(10)) where Entry like '%}%'")

compiles, but gives SQLiteException
no such function: char (code1)

at run time.

Changing the replace string to '\10' or '\\10' will run, but this just inserts those literal characters - that is, text punctuated by \10 like this\10, not the line feeds that I want. ("Entry" is a field of type Text in my SQLite database.)

Can this be done, or will SQLite not accept these characters within text fields?

Thanks for any help.
 
Upvote 0
Thanks for the suggestion but I'm afraid it doesn't work for me - if I use the line above with the 'a' removed from 'char' I still get a runtime error "No such function: chr (code 1)".
 
Upvote 0
I've also tried the following. This also compiles but gives a similar runtime error

Dim R As String: R = Chr(10)
OurCursor = G.SQL1.ExecQuery("Update DEntries set Entry = replace(Entry, '}'," & R & ") where Entry like '%}%'")
 
Upvote 0
The following will replace the '}' with new line feeds.

Code: Copy
  Update DEntries set Entry = replace(Entry, '}', X'0A') where Entry like '%}%';
 
Last edited:
Upvote 0
Thanks Cimperia! That seems to have solved my problem. Brilliant.
 
Upvote 0

Similar Threads

  • Locked
  • Article Article
Android Tutorial SQL tutorial
Replies
161
Views
338K
Back
Top