|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Replace NULL value
Is it possible to update NULL value?
My datatype for the field is float i tried: update table1 set [value1] = '0' where [value1] = '' however it does not replace the null value. So what is the sql statement? Thanks |
|
#2
|
|||
|
|||
|
Try using this.This Shld.Work
update table1 set [value1] = 0 where [value1] is null |
|
#3
|
|||
|
|||
|
You have to remember null is a special value. nothing equals null not even null:
select null = null ; ->false select null = "" ; ->false The way to find nulls one must use the word is select null is null; -> true |
|
#4
|
|||
|
|||
|
Thanks a lot
U guys are wonderful |
|
#5
|
|||
|
|||
|
Instead of dealing with nulls after they are insterted into the table, you can use ISNULL
e.g. INSERT INTO Bananas (monkeyid) SELECT ISNULL(monkeyid,0) FROM Monkeys This will insert a 0 if monkeyid is null. |
|
#6
|
|||
|
|||
|
Quote:
quite comical ...and also 100% correct, remember that a 0 length string is not the same as null data...which is what you were using here (a 0 length string)Code:
... where [value1] = '' |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Replace NULL value |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|