Re: UPDATING TO NULL
Posted in 1999
Topics: Triggers, Constraints & Referential Integrity
You can try :- Update table set column_name = "" where column_name = Value kirt wrote: > How do I update a field with NULL (blank it out) > > I have tried something like > > update Table > set column_name to null > where column_name2 = VALUE > > the field is an integer that is a foreign key to another table's id column > > thanks > kirt
Wu wrote: > You can try :- > > Update table > set column_name = "" > where column_name = Value You can try this, but in the context of a string column, it would insert a blank string, not a null string. Since the question is about an integer column, this might produce the correct null answer; there isn't much else you can convert an empty string to. But the safe, general solution is, as Kgoozis said, to use SET column_name = NULL or to set an integer variable to null in the program and then use: SET column_name = null_integer_variable > kirt wrote: > > > How do I update a field with NULL (blank it out) > > > > I have tried something like > > > > update Table > > set column_name to null > > where column_name2 = VALUE > > > > the field is an integer that is a foreign key to another table's > > id column Given that the column is also a foreign key, you may not be allowed to set the value to null at all. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>