>thanks Simon and Igor for your help on this a few weeks ago, but I 
>need an
>addition to
>
>UPDATE Aircraft SET CN = '*' where CN = '' or CN is null;
>
>what I need to do is replace blank fields in a specific row, sort of
>a double where where statement as in:
>
>UPDATE Aircraft SET CN = '*' where CN = '' or CN is null where 
>(primary key)
>is xyz
>
>What I'm trying to do is update a database, but the users also have an
>automated update system
>that apparently if it finds any blank fields in the row, updates the 
>whole
>row, thereby overwriting
>what I've replaced.  I thought if I could at least replace the blank 
>fields
>with something, it should
>prevent the overwriting.  I don't know which fields are blank, every user
>will be different, so the
>plan was to update the fields I want to, insert text/symbol into the 
>blank
>fields and leave the others
>alone.  I realize that because I don't know which fields are 
>empty/blank I'm
>going to have to create
>a statement for every column I'm not updating to, there are only 10 
>columns
>altogether and I'll
>typically be updating to at least 5 of them.

You should be able to acheive what you want (keep as many columns 
non-empty and non-blank) even while users cause rows update which don't 
follow your rules.

Create an AFTER UPDATE OF (colA, colB, ... ) WHEN new.colA = '' OR 
new.colA IS NULL OR new.colB = '' OR new.colB IS NULL OR ... trigger 
where you can force some value in the columns of your choice.  It will 
surely slightly slow down insert rate, but that doesn't seem to be a 
blocking reason in your case. 

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

Reply via email to