473,721 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

are nulls bad

aaj
Hi

I am probably going to regret asking this because I'm sure you are going to
tell me my design is bad 8-) ah well we all have to learn....

anyway

I often use Nulls as a marker to see if certain tasks have been completed.

A typical example would be a column say invoice_value

when new work is entered and a new record is appended, I leave the
invoice_value column as NULL, so if I want a View for uninvoiced work I
check for the invoice_value being equal to NULL, and alternatively if I want
invoiced work, I check for not null. I did it this way to save putting in
another column that needed to be set to TRUE or FALSE. (I do similar things
elsewhere aswell)

so far everything seems to work OK but reading some old stuff on Google I
get the feeling that NULLS should be left alone, have I done wrong?

many thanks

Andy

Jul 20 '05 #1
3 2012
On Tue, 25 May 2004 15:08:27 +0100, aaj wrote:
Hi

I am probably going to regret asking this because I'm sure you are going to
tell me my design is bad 8-) ah well we all have to learn....

anyway

I often use Nulls as a marker to see if certain tasks have been completed.

A typical example would be a column say invoice_value

when new work is entered and a new record is appended, I leave the
invoice_valu e column as NULL, so if I want a View for uninvoiced work I
check for the invoice_value being equal to NULL, and alternatively if I want
invoiced work, I check for not null. I did it this way to save putting in
another column that needed to be set to TRUE or FALSE. (I do similar things
elsewhere aswell)

so far everything seems to work OK but reading some old stuff on Google I
get the feeling that NULLS should be left alone, have I done wrong?

many thanks

Andy


Hi Andy,

I don't think NULLS are bad. I do think they arer tricky and many errors
have been caused by improper understanding of NULLS and three-valued
logic.

As to your design- I don't think it's bad. In similar cases, I tend to use
a column that stores the date/time a task is finished. And (like you) I
use column_name IS NULL (*not* column_name = NULL!!!!) to find unfinished
work.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Jul 20 '05 #2
aaj,

I agree with Hugo, but here's an alternate viewpoint from Aaron's site:

http://www.aspfaq.com/show.asp?id=2073

-Andy

"aaj" <a.*@c.com> wrote in message
news:40******** **************@ news.easynet.co .uk...
Hi

I am probably going to regret asking this because I'm sure you are going to tell me my design is bad 8-) ah well we all have to learn....

anyway

I often use Nulls as a marker to see if certain tasks have been completed.

A typical example would be a column say invoice_value

when new work is entered and a new record is appended, I leave the
invoice_value column as NULL, so if I want a View for uninvoiced work I
check for the invoice_value being equal to NULL, and alternatively if I want invoiced work, I check for not null. I did it this way to save putting in
another column that needed to be set to TRUE or FALSE. (I do similar things elsewhere aswell)

so far everything seems to work OK but reading some old stuff on Google I
get the feeling that NULLS should be left alone, have I done wrong?

many thanks

Andy

Jul 20 '05 #3
aaj
Thanks for the replies, I feel a little better

I'll give the link some more study

thanks again

Andy

"aaj" <a.*@c.com> wrote in message
news:40******** **************@ news.easynet.co .uk...
Hi

I am probably going to regret asking this because I'm sure you are going to tell me my design is bad 8-) ah well we all have to learn....

anyway

I often use Nulls as a marker to see if certain tasks have been completed.

A typical example would be a column say invoice_value

when new work is entered and a new record is appended, I leave the
invoice_value column as NULL, so if I want a View for uninvoiced work I
check for the invoice_value being equal to NULL, and alternatively if I want invoiced work, I check for not null. I did it this way to save putting in
another column that needed to be set to TRUE or FALSE. (I do similar things elsewhere aswell)

so far everything seems to work OK but reading some old stuff on Google I
get the feeling that NULLS should be left alone, have I done wrong?

many thanks

Andy

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1899
by: Dan Perlman | last post by:
From: "Dan Perlman" <dan@dpci.NOSPAM.us> Subject: ODBC creating nulls? Date: Friday, July 09, 2004 10:43 AM Hi, Below is my VB6 code that writes data from an Access 2000 table to a PG table. The " & "" " on the right of each line should prevent nulls from being
2
2361
by: Steve Walker | last post by:
Hi all. I've been tasked with "speeding up" a mid-sized production system. It is riddled with nulls... "IsNull" all over the procs, etc. Is it worth it to get rid of the nulls and not allow them in the columns anymore? If so, how to go about removing the nulls with a script?
6
28300
by: mike | last post by:
I'm doing what I thought was a simple GROUP BY summary of fairly simple data and the my numbers aren't working out Some results are showing up <NULL> when I know the data is in the database I'm no SQL expert, but if I'm summing (SUM) multiple fields and adding them together in my SELECT how does SUM handle Null? In some situations a single column in a single row is Null but and it's part of a larger GROUP BY and SUM and from looking...
0
1583
by: Rhino | last post by:
I am working with SQL Functions in DB2 for Windows/Linux/UNIX (V8.2.1) and am having a problem setting input parameters for SQL Functions to null in the Development Center. My simple function, called Half, has a single integer input parameter and divides this value by two to produce its result. It also tests the input parameter to see if it is null; if it is null, it returns null. When I click the Run button and try to use the SET TO...
1
2072
by: PST | last post by:
Here's a problem I'm trying to deal with: I'm working on a Frontpage 2000 website for a boat handicapping system, built in Access 97. What I'm trying to accomplish is: The user enters a boat name in a text field OR a sail number in a text field, and gets the desired boat record back (an exact match).
13
2378
by: jt | last post by:
I can't seem to find a way to concatenate strings that have nulls within the string. I have a string that I need another string that has nulls in it and what to append the 2nd string, 3 string and so forth to the 1st string. Any ideas how to go about this? Thanks,
3
1311
by: Simon | last post by:
Hi all, Do you think the best way to avoid the problems of nulls in the database is just to provide default values via the db schema? Alternatively, is it better to allow nulls, seeing as the "absence" of data is an entirely valid and useful value? If the later is true, is there a better way to handle nulls that doing this for each and every column of each and every table? I'm hoping there is
2
15896
by: Rey | last post by:
Howdy all. My problem deals w/inserting nulls into database (SQL Svr 2K) for the datetime fields activityDate and followUpDate where nulls are allowed. >From the web form, the user can type in/select the activity or followup date. If, for this exercise, the followupdate textfield is empty, then when the insert method of the class calls the InsertActivityLog stored procedure, how can I get nulls inserted instead of 1/1/1900 because of
6
5451
by: Cliff72 | last post by:
I need to fill in the nulls in the batch field the value from the record immediately preceding the null one ie replace the nulls with the preceding value until I hit a record with a value in it--then hold the next value through the next set of nulls, and so on. See example below: I wanna copy down batch "IMR138" in record ID 1, all the way to ID 10. Then copy down batch "7138" all the way to ID 20 and so on....
0
9365
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9127
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8002
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5973
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4483
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4748
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3186
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2569
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2127
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.