Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating NULL values

Status
Not open for further replies.
Sep 10, 2009
37
US
I am trying to update a table I created that have NULL in one of the fields.


UPDATE clientidtoclientrollup
SET rollupid = clientid
WHERE clientid is null

Returns: (0 row(s) affected)

Thanks for any suggestions...
 
What do you get for the following?

Code:
 SELECT COUNT(*)
   FROM ClientIdToClientRollup
  WHERE ClientId IS NULL

--Jeff Moden
-------------------------------------------------------------------------------
"RBAR" is pronounced "ree-bar" and is a "Modenism" for "Row By Agonizing Row
 
Did you want to put NULL into the other field too for all records where ClientID IS NULL? May be you wanted to do this where ClientID IS NOT NULL ?
 
Ah... I hadn't thought about that. I just took the code at face value. Perhaps what is sought could be the following?

Code:
 UPDATE ClientIdToClientRollup
    SET RollupId = ClientId
  WHERE RollupId IS NULL
    AND ClientID IS NOT NULL

--Jeff Moden
-------------------------------------------------------------------------------
"RBAR" is pronounced "ree-bar" and is a "Modenism" for "Row By Agonizing Row
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top