# Databases > SQL Server - update to null value column

## priyasp_msit

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

----------


## debasisdas

try using
*
update emp set comm=5000 where email_id is null*

----------


## vikasvaidya

> 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

----------


## chennaprashanth

> 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  :Smile: 
Prashanth Chenna,

----------


## nageshkota

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...

----------


## chennaprashanth

> 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.

----------


## nageshkota

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".

----------


## chennaprashanth

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

----------

