An SQL query to return an UPDATE for the results?
Dr. Hawkins
dochawk at gmail.com
Wed Aug 7 10:49:10 EDT 2013
With an SQLite database in memory, and a "real" database either on
machine or remote, I need to sync the two.
I'm trying to find a clever & fast way to create a SELECT query that
produces the corresponding UPDATE query.
I can do something like "SELECT " & 'UPDATE sometable SET col1=''" &
col1 & "'' WHERE key=''" & keyval & "'';" WHERE key =' & keyval & "';"
to return
UPDATE sometable SET col1='thevalue' WHERE key='keyval';
but this doesn't accommodate NULL values, which would come back as
empty but need to become NULL rather than ''
I suppose I could do a
replace "''" with "NULL" in myQuery --for null strings
replace ",," with ",NULL," in myQuery --for null numbers
(and,f or that matter, null strings don't matter much.
Am I on to something, or am I missing something big here?
--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
More information about the use-livecode
mailing list