Subject | Re: Why is this telling me |
---|---|
Author | Adam |
Post date | 2005-08-29T23:25:12Z |
--- In firebird-support@yahoogroups.com, Jason Dodson <jasond@b...>
wrote:
there is no other
NULL means UNDEFINED or UNKNOWN.
It does not mean EMPTY STRING or ZERO.
It may possibly be '' or 0, but is may possibly be some other value.
You should only default a string to '' if it is indeed empty.
For example, the consider a persons middle name.
If you do not know the middle name or even if the middle name exists
or not, then NULL is the correct value.
If you do know that there is no middle name, then '' is the correct
value.
You can use the Coalesce function to easily run comparisons. Of
course the middle name is a trivial example, if you were to
incorrectly set it to '', then it probably wouldn't matter anyway,
but it is technically not correct. "You are saying that I know they
don't have a middle name", not "I am not sure of the middle name,
they didn't tell me"
Adam
wrote:
> It is also terrible to allow String fields to be NULL in the firstplace. The ONLY time things should be allowed to carry NULL is if
there is no other
> means to indicate 'No Value', such as a date. Strings shoulddefault to '', currency to $0, etc...
>Jason I disagree.
> Jason
NULL means UNDEFINED or UNKNOWN.
It does not mean EMPTY STRING or ZERO.
It may possibly be '' or 0, but is may possibly be some other value.
You should only default a string to '' if it is indeed empty.
For example, the consider a persons middle name.
If you do not know the middle name or even if the middle name exists
or not, then NULL is the correct value.
If you do know that there is no middle name, then '' is the correct
value.
You can use the Coalesce function to easily run comparisons. Of
course the middle name is a trivial example, if you were to
incorrectly set it to '', then it probably wouldn't matter anyway,
but it is technically not correct. "You are saying that I know they
don't have a middle name", not "I am not sure of the middle name,
they didn't tell me"
Adam