UPDATING TO NULL
Posted in 1999
Topics: Triggers, Constraints & Referential Integrity
The correct syntax is: update Table set column_name = null where column_name2 = VALUE But I think that primary keys can't be null (or is it that they can be null as long as they are unique - meaning only one record in Table can have a null value for column_name?). Naturally foreign keys can't be null (unless null is an allowed value for the primary key they are referencing). Please refresh our memory once you figure it out :) Kleanthis
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
This statement: "How do I update a field with NULL (blank it out)" indicates a lack of differentiation between two concepts. Concept 1: NULL. This is a slippery slope in relational databases and often discussed. It means that a value is unknown. Concept 2: blank it out. A blank is not NULL, it is known. If this was a char, then blanking it out can be mean "" or " ". If this is an integer, then the phrase is confusing and the phrase "zero out" makes more sense. In any case, a zero is not the same as a NULL. And of course a "blank" in the ascii character set is represented as the number 040, but I suppose you aren't referring to this. So, let us know why you are "blanking it out" and what behaviors you are looking for. 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
Actually, foreign key columns can be null. If any of columns of the foreign key are null, Informix ignores the constraint check during an INSERT or UPDATE statement. Rudy In article <19990429221742.29267.00000342@ng67.aol.com>, kgoozis@aol.com (Kgoozis) wrote: > The correct syntax is: > > update Table > set column_name = null > where column_name2 = VALUE > > But I think that primary keys can't be null (or is it that they can be null as > long as they are unique - meaning only one record in Table can have a null > value for column_name?). > Naturally foreign keys can't be null (unless null is an allowed value for the > primary key they are referencing). > > Please refresh our memory once you figure it out :) > > Kleanthis > > -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
In response maybe my terminology is incorrect. The integer in this field references the id of another table. I would like to remove the value in the referencing table not the id itself. I want the table is referenced to be untouched. I will test : update table set column_1 ="" where column_2 = value then I will respond with the results thanks kirt Vic Glass <icc@injersey.infi.net> wrote in message news:37298F7D.CA692022@injersey.infi.net... > This statement: "How do I update a field with NULL (blank it out)" indicates a > lack of differentiation between two concepts. > Concept 1: NULL. > This is a slippery slope in relational databases and often discussed. It means > that a value is unknown. > Concept 2: blank it out. A blank is not NULL, it is known. If this was a char, > then blanking it out can be mean "" or " ". If this is an integer, then the > phrase is confusing and the phrase "zero out" makes more sense. In any case, a > zero is not the same as a NULL. And of course a "blank" in the ascii character > set is represented as the number 040, but I suppose you aren't referring to > this. > > So, let us know why you are "blanking it out" and what behaviors you are > looking for. > > 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 >