Unix Technical Forum

sql

This is a discussion on sql within the SQL Server forums, part of the Microsoft SQL Server category; --> It's better to use "null" values or "0" and "" ? thank you...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 04:18 AM
Utopian [ FTa ]
 
Posts: n/a
Default sql

It's better to use "null" values or "0" and "" ?

thank you


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 04:18 AM
Hugo Kornelis
 
Posts: n/a
Default Re: sql

On Sun, 20 Jun 2004 10:20:35 +0200, Utopian [ FTa ] wrote:

>It's better to use "null" values or "0" and "" ?
>
>thank you
>


Hi Utopian,

You'll probably get different answers to this question. Many people advise
against using NULLs, because some of the consequences of having NULL in a
database are not well understood by many programmers.

I think you should use NULLs to indicate missing information. If you
combine attributes that are not directly related into one table, you must
expect that there will be occasions that not all information can be stored
(for whatever reason). Some people choose to store special values (like
zero, the blank string or 1/1/1900) to indicate this, trying to avoid the
"problems" they perceive with NULL. Instead, they only hide these
problems, and add some extra problems to boot.

An RDBMS comes with a special instrument to deal with unknown values. That
special instrument is NULL. It's just silly to avoid this instrument and
make up your own instead, just because some programmers don't understand
how three-valued logic works. Much better would be to teach these
programmers to do their job properly.

Of course, regardless of whether unknown values are stored as NULL or as
special values, it's always best to allow as little unknown values as
possible.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-29-2008, 04:18 AM
Utopian [ FTa ]
 
Posts: n/a
Default Re: sql

Ok. Thank you.
I think i continue to use "null" values ;-)


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-29-2008, 04:18 AM
--CELKO--
 
Posts: n/a
Default Re: sql

>> It's better to use "null" values or "0" and "" ? <<

Where to start? Well, the double quote mean that you have a user
created data element name; and NULLs are not values. I think that if
you knew the bare foundations of SQL and a little grammar, you might
have meant to post:

>> Is it better to use NULLs, or to use 0 and ''? <<


Now the question is silly and not incoherent. Now we have NULL, a
numeric zero and an empty string.

The answer is "use for what?" Which is better- a screw or a basket
ball? Does your application and data model require a value or a NULL?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:48 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com