homepage Welcome to WebmasterWorld Guest from 54.196.136.119
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
INSERT vs. UPDATE for column data
Can I use UPDATE if the column value is NULL?
pillsbur




msg:3674255
 5:48 pm on Jun 13, 2008 (gmt 0)

Hi,

I'm wondering if it's possible to use UPDATE on a row where it's unknown whether the column being updated already has a value or not.

If the column's value is set to NULL, will UPDATE work? Or do I really need to test for NULL and write either an UPDATE or an INSERT query? I'd really like to streamline my code by not having to do the test, but I don't know how far UPDATE will go.

By the way, I looked at REPLACE INTO, but I'm not worried about an entire row of data, just a single column in an existing row.

Thanks,
Glenn

 

phranque




msg:3674669
 8:26 am on Jun 14, 2008 (gmt 0)

INSERT inserts a new ROW.
UPDATE modifies an existing row's VALUE(s).

pillsbur




msg:3674900
 7:55 pm on Jun 14, 2008 (gmt 0)

Thanks. Of course you're right. That clears things up for me. UPDATE it is!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved