MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 7th, 2004, 10:30 PM
awbrab awbrab is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Singapore
Posts: 28 awbrab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old July 8th, 2004, 12:34 AM
dkashyap dkashyap is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 19 dkashyap User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 4 m
Reputation Power: 0
Try using this.This Shld.Work

update table1
set [value1] = 0
where [value1] is null

Reply With Quote
  #3  
Old July 8th, 2004, 12:56 AM
appodictic appodictic is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 2 appodictic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #4  
Old July 8th, 2004, 01:34 AM
awbrab awbrab is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Singapore
Posts: 28 awbrab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks a lot
U guys are wonderful

Reply With Quote
  #5  
Old July 8th, 2004, 10:34 AM
pickledshark pickledshark is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Blackpool
Posts: 22 pickledshark User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 32 sec
Reputation Power: 0
Send a message via ICQ to pickledshark Send a message via MSN to pickledshark
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.

Reply With Quote
  #6  
Old July 9th, 2004, 09:26 PM
Username=NULL Username=NULL is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: TX
Posts: 249 Username=NULL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 7 h 6 m 42 sec
Reputation Power: 5
Send a message via Yahoo to Username=NULL
Quote:
Originally Posted by appodictic
You have to remember null is a special value. nothing equals null not even null:

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] = ''

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Replace NULL value


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT