473,789 Members | 2,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6394
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****@rightco de.net> wrote in message
news:bi******** ***@FreeBSD.csi e.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****@rightco de.net> wrote in message
news:bi******** ***@FreeBSD.csi e.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****@rightco de.net> wrote in message
news:bi******** ***@FreeBSD.csi e.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
2364
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 null default 0 auto_increment, a1 varchar(64) not null default '',
6
2484
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 components in the vector) is given by the variable name veclength. That is what I _do_ understand. What I don't understand is the coding for the default constructor which includes vec=0; What does it mean for a pointer to be equal to 0? Presumably...
4
2505
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, "error in recvfrom.\n"); exit(1); } The packet I am receiving has the following possible structure.
10
3489
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 { return dbConnectionString;
10
4591
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 zero-length string (always returns a zero-length string when used in a query expression)" **** How many records are there in FirstTable in which Product Is Null. SELECT COUNT(*) AS CountofNullProdcut
17
4534
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 selected into 2 different SP variables and compared for equal. They are both NULL, but do not compare as equal. When the Not NULL columns (SALARY) are compared, they do compare as equal.
5
1786
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 fields on the spreadsheet. I set the Access table up so that all the numerical values would have a default value of zero. I thought that when the record was appended to the table that the numerical fields that do not have values would be...
5
4681
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 SelectParameters with a SessionParameter in the parameters collection and the object stored in the Session is a reference type, the DataGrid fails to enter Line Editing mode. Is this a bug? Is there a workaround for this problem?
6
5169
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 application working. However, when attempting to implement the solution, the AJAX calls weren't updating the screen like the examples were and seemed not to fire until after the long running process had completed. I found the only real...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
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
9983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5417
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...
1
4092
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
3700
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
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.