SQL emptying a column
-
Hi there. Ok, If I have a database with columns "FirstName" and "LastName" I could insert a row with no value for last name by calling INSERT INTO TableName (FirstName) VALUES ('Matt') Ok, easy. However, if I have a row already entered with a first and last name, how would I clear the first name to an empty value? By which I mean no value at all rather than an empty string. Can I do this with an UPDATE call? Is there a keyword to use such as "FirstName = NULL"? I could of course delete the row and add it again, but it seems like it should be easier than that.
-
Hi there. Ok, If I have a database with columns "FirstName" and "LastName" I could insert a row with no value for last name by calling INSERT INTO TableName (FirstName) VALUES ('Matt') Ok, easy. However, if I have a row already entered with a first and last name, how would I clear the first name to an empty value? By which I mean no value at all rather than an empty string. Can I do this with an UPDATE call? Is there a keyword to use such as "FirstName = NULL"? I could of course delete the row and add it again, but it seems like it should be easier than that.
I may not have the syntax exactly correct but try this out
update TableName
set LastName to NULL
where FirstName = 'Matt';Chris Meech "what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002. "Microsoft hasn't ever enforced its patents. Apparently they keep them for defensive reasons only. Or, they could be waiting 'til they have a critical mass of patents, enforce them all at once and win the game of Risk that they're playing with the world." Chris Sells Feb 18, 2003.