On 22 Nov 2017, at 9:56pm, Shane Dev <devshan...@gmail.com> wrote:

> P.S I know that substr('xxxxxxxxx', 1, stringlengths.length) would work in
> this particular case but then I must know maximum value of
> stringlengths.length at the point of time when I construct the query. Is
> there a more flexible way?

Your above solution is the simplest fastest way of getting your result.  It 
will perform extremely quickly and continue to work if you ever decide to move 
from SQLite to some other SQL engine.  It is the solution I’d use unless the 
lengths could get above 200 or so.

A technically cleaner solution would be to implement your own external function 
which takes an integer and produces the appropriate string.  This would be a 
lot more work, and would stop working if you switched to some other SQL engine.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to