Results 1 to 8 of 8

Thread: update to null value column

  1. #1
    Contributing Member
    Join Date
    Jul 2007
    Answers
    42

    update to null value column

    i want update all null value colums
    for example for emp table
    id name comm email_id
    101 TATA 1000 null


    update emp set comm=5000 where email_id =null

    is it possiable


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: update to null value column

    try using

    update emp set comm=5000 where email_id is null



  3. #3
    Contributing Member
    Join Date
    Jun 2007
    Answers
    65

    Re: update to null value column

    Quote Originally Posted by priyasp_msit View Post
    i want update all null value colums
    for example for emp table
    id name comm email_id
    101 TATA 1000 null


    update emp set comm=5000 where email_id =null

    is it possiable
    Hi Priya,

    We can not use to compare a null value with '=' operator. For this we have to use the 'is' keyword.

    You can use this
    update emp set comm=5000 where email_id is null

    ---V V---
    Vikas Vaidya


  4. #4
    Junior Member
    Join Date
    Mar 2008
    Answers
    24

    Re: update to null value column

    Quote Originally Posted by priyasp_msit View Post
    i want update all null value colums
    for example for emp table
    id name comm email_id
    101 TATA 1000 null


    update emp set comm=5000 where email_id =null

    is it possiable

    Its not like that,
    We will get it by trying this,

    Update emp set comm=5000 where email_id is null


    On comparing NULL values Use the key word IS


    Cherrs
    Prashanth Chenna,


  5. #5
    Contributing Member
    Join Date
    Apr 2008
    Answers
    31

    Re: update to null value column

    Priya,

    In the database one null value never equals to the another null value, so you can't use "=" for null check. You have to use "IS Null" like that...


  6. #6
    Junior Member
    Join Date
    Mar 2008
    Answers
    24

    Re: update to null value column

    Quote Originally Posted by nageshkota View Post
    Priya,

    In the database one null value never equals to the another null value, so you can't use "=" for null check. You have to use "IS Null" like that...
    Hi,

    To set a NULL Value in a cell we can use the Operator "="
    But on executing a Condition on NULL Value we have Use the Key word "is"
    ( So, according to situation we can use either = or Is )

    Ex:
    1. Update emp set eno=11 where salary is NULL
    2. Update emp eno=Null wher ename is 'Prashanth'

    Please post ur Comments.

    Regards,
    Prashanth Chenna.


  7. #7
    Contributing Member
    Join Date
    Apr 2008
    Answers
    31

    Re: update to null value column

    Prasanth,

    u r right u can assign to null value as u given in the sample query, but u can't use the "=" in the where clause, in that case you have to use only "IS".


  8. #8
    Junior Member
    Join Date
    Mar 2008
    Answers
    24

    Re: update to null value column

    Hi Nagesh,
    I didn't get u clearly. Please give some Examples to justify ur answer.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact