Nice approach Norman.

Just a question as I don't use regularly substrings and concanetations. Aren't
these operations (using substrings and concanetations) on a UPDATE slower than
gettings all records and update them?

Carlos

On Feb 12, 2007 11:08 PM, Norman Palardy wrote:
> On Feb 12, 2007, at 3:33 PM, Juan Pablo Garcia wrote:
>
> > I want to find "aString" in the column "names" of a table "people"
> > where I have 2 strings ("aString" and "bString" separated by a comma)
> > I can“t see a replace command in Sqlite sintax.
>
> There's no "replace" function but you could use substrings to chop it
> apart and then concatenate the new value using the concatenation
> operator which is ||
>
> you'll have to use something like
>
>       update people set names = newAString || substr(names,length(astring)
> +1,999) where names like "aString%"
>
> although this will only replace those where aString is the first part
> of the string
>
> Where aString is the second portion you'll need to do something like
>
>       update people set names = substr(names,1,length(names)-length
> (aString)) || newAString where names like "%aString"
>
> of course test these with selects before you just run them
>
>       select newAString || substr(names,length(astring)+1,999) from people
> where names like "aString%"
>
>       select substr(names,1,length(names)-length(aString)) || newAString
> from people where names like "%aString"

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to