473,395 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

When to use NULL as default value

Hi all,

I pretty much set a fields default value to NULL if it not a "required"
field in my app. Just wondering if this is the way to go since I just
sort of guessed at this method ;)

- Charles
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
3 6370
Charles - the answer is -
it depends .
For example - if you are using a report tool that actually shows the .NULL.
value in the report,
your users probably won't want this. Its a lot of extra coding in your
report tool to make that go away, and you won't know exactly all of the
columns you want to apply the null rule to on your report tool without some
trial runs. IF you make default some white space, or a zero [depending on
the data type] in your fields default value in the mySQL table, then you
have removed some extra work time for you or another programmer come time to
do the report work.
On the other hand, checking for nulls in code, the regular way, is thereby
changed when you are using whitespace, and its a PITA .... ISNULL doesn't
work anymore [wah!!!]

let me know your thoughts ??
mondo regards [Bill]

--
William Sanders / Electronic Filing Group Remove the DOT BOB to reply via
email.
FREE LONG DISTANCE -> mailto:ex********@efgroup.net
mySql / VFP / MS-SQL
"Charles Kline" <ck****@rightcode.net> wrote in message
news:bi***********@FreeBSD.csie.NCTU.edu.tw...
Hi all,

I pretty much set a fields default value to NULL if it not a "required"
field in my app. Just wondering if this is the way to go since I just
sort of guessed at this method ;)

- Charles
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #2
Charles - the answer is -
it depends .
For example - if you are using a report tool that actually shows the .NULL.
value in the report,
your users probably won't want this. Its a lot of extra coding in your
report tool to make that go away, and you won't know exactly all of the
columns you want to apply the null rule to on your report tool without some
trial runs. IF you make default some white space, or a zero [depending on
the data type] in your fields default value in the mySQL table, then you
have removed some extra work time for you or another programmer come time to
do the report work.
On the other hand, checking for nulls in code, the regular way, is thereby
changed when you are using whitespace, and its a PITA .... ISNULL doesn't
work anymore [wah!!!]

let me know your thoughts ??
mondo regards [Bill]

--
William Sanders / Electronic Filing Group Remove the DOT BOB to reply via
email.
FREE LONG DISTANCE -> mailto:ex********@efgroup.net
mySql / VFP / MS-SQL
"Charles Kline" <ck****@rightcode.net> wrote in message
news:bi***********@FreeBSD.csie.NCTU.edu.tw...
Hi all,

I pretty much set a fields default value to NULL if it not a "required"
field in my app. Just wondering if this is the way to go since I just
sort of guessed at this method ;)

- Charles
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #3
Charles - the answer is -
it depends .
For example - if you are using a report tool that actually shows the .NULL.
value in the report,
your users probably won't want this. Its a lot of extra coding in your
report tool to make that go away, and you won't know exactly all of the
columns you want to apply the null rule to on your report tool without some
trial runs. IF you make default some white space, or a zero [depending on
the data type] in your fields default value in the mySQL table, then you
have removed some extra work time for you or another programmer come time to
do the report work.
On the other hand, checking for nulls in code, the regular way, is thereby
changed when you are using whitespace, and its a PITA .... ISNULL doesn't
work anymore [wah!!!]

let me know your thoughts ??
mondo regards [Bill]

--
William Sanders / Electronic Filing Group Remove the DOT BOB to reply via
email.
FREE LONG DISTANCE -> mailto:ex********@efgroup.net
mySql / VFP / MS-SQL
"Charles Kline" <ck****@rightcode.net> wrote in message
news:bi***********@FreeBSD.csie.NCTU.edu.tw...
Hi all,

I pretty much set a fields default value to NULL if it not a "required"
field in my app. Just wondering if this is the way to go since I just
sort of guessed at this method ;)

- Charles
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #4

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

Similar topics

0
by: Soefara | last post by:
Dear Sirs, I am experiencing strange results when trying to optimize a LEFT JOIN on 3 tables using MySQL. Given 3 tables A, B, C such as the following: create table A ( uniqueId int not...
6
by: pauldepstein | last post by:
I am reading Grimshaw and Ortega's "C++ and Numerical Methods." They construct a vector class which contains the variable vec, a float* variable where the length of the array (number of...
4
by: QQ | last post by:
Hello I am a newbie on network programming. I am trying to receive a packet if((numbytes = recvfrom(udp_fd1, buf, MAXLEN-1, 0,(struct sockaddr*)&register_addr, &addr_len))==-1){ fprintf(stderr,...
10
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get...
10
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbaac11/html/acfctNZ_HV05186465.asp "If the value of the variant argument is Null, the Nz function returns the number zero or a...
17
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are...
5
by: rdemyan via AccessMonster.com | last post by:
I have a table with about 80 fields. I'm using an import process to populate the table. It works fine, except for the following: Users generally don't specify values for a lot of numerical...
5
by: =?Utf-8?B?QWRhciBXZXNsZXk=?= | last post by:
Hi All, I have a GridView inside the EditItemTemplate of a FormView. Both FormView and GridView are data bound using an ObjectDataSource. When the FormView's ObjectDataSource object has a...
6
by: =?Utf-8?B?U2hhd24gU2VzbmE=?= | last post by:
Greetings! I was researching AJAX to provide a solution to displaying status messages while a long process executed. I found several examples online and was able to use their code to get a quick...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...

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.