<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1019194" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1019194</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/allow-zero-length-strings-field#comment-1114313</link>
    <description> &lt;p&gt;I wouldn&#039;t allow zero-length strings even for middle name. I would put logic in my handler that would only save the middle name if it&#039;s trimmed length was equal to 1 or greater.&lt;/p&gt;
&lt;p&gt;You don&#039;t have to use nulls as your default value. If you want to use 0 as the default value for a numeric field that would be ok as long as you modified your code to recognize the 0 then be sure not to save nulls because then you would have to check for both.&lt;/p&gt;
&lt;p&gt;Your queries will be much simpler when all you have to do is check for null and not for a default value and/or the length of the string.&lt;/p&gt;
 </description>
     <pubDate>Wed, 18 Sep 2002 01:52:08 +0000</pubDate>
 <dc:creator>Peter J. Boettcher</dc:creator>
 <guid isPermaLink="false">comment 1114313 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/allow-zero-length-strings-field#comment-1114268</link>
    <description> &lt;p&gt;So how about the following as a field properties strategy;&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;fields&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; required&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; allow zl strings&lt;br /&gt;------&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ---------&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----------------&amp;nbsp; &lt;br /&gt;nameFirst&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; no&lt;br /&gt;nameMiddle&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; no&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes &lt;br /&gt;nameLast&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yes&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; no&amp;nbsp;&amp;nbsp; &lt;br /&gt;cutomerGroupID&amp;nbsp;&amp;nbsp; no&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;userPassword&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; no&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; no&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Fields like first name and last name must have proper string values in order for the listing to make sense. So we don&#039;t want to allow any nulls or zero length strings&lt;/p&gt;
&lt;p&gt;Middle name can have a null or a zero length string. This way I don&#039;t have to worry when I have a web page form which allows the customer to submit a field with middle name input. My db update script won&#039;t have to handle that field in any particular way. Whether I pass over it when request.form(&quot;txtNameMiddle&quot;) equals an empty string so that a value of null is assigned or allow its value to be written to the field in this case resulting in a zero string the db will not return an error.&lt;/p&gt;
&lt;p&gt;cutomerGroupID should be able to contain nulls or a numerical value and its default value should be null so that we can query for customers who do not belong to any group with a WHERE IS NULL clause.&lt;/p&gt;
&lt;p&gt;userPassword is like customerGroupID except its a text field. We want to allow nulls because not every customer will have a password. Most will use email as password, and we will want to query for customers without passwords. So if the web form brings us an empty string for this field, I want to enforce a scripting policy of passing up this db field rather than assigning it the zero length string.&lt;/p&gt;
&lt;p&gt;Am I correct here in assuming that for ease of query purposes whenever I have a field where lack of value will be significant, I should use null as opposed to other default values such as 0 for numerical fields and zero length strings for string fields?&lt;/p&gt;
&lt;p&gt;Please comment on all my assumptions here if there are mistakes, not just the question.&lt;/p&gt;
 </description>
     <pubDate>Tue, 17 Sep 2002 17:28:34 +0000</pubDate>
 <dc:creator>akohl</dc:creator>
 <guid isPermaLink="false">comment 1114268 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/allow-zero-length-strings-field#comment-1114153</link>
    <description> &lt;p&gt;Yep, that sounds correct.&lt;/p&gt;
 </description>
     <pubDate>Mon, 16 Sep 2002 01:34:57 +0000</pubDate>
 <dc:creator>Peter J. Boettcher</dc:creator>
 <guid isPermaLink="false">comment 1114153 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/allow-zero-length-strings-field#comment-1114141</link>
    <description> &lt;p&gt;Yes, you&#039;re right about that. I just looked it up in Access Database Design and Programming by Steven Roman.&lt;/p&gt;
&lt;p&gt;So if I choose no for the &quot;required&quot; property and no for the &quot;allow zero length string&quot; then I can place a value of null in the field but not a string value of &quot;&quot;.&lt;/p&gt;
&lt;p&gt;then I can filter for principal addresses in this example above with WHERE parentAddressID IS NULL.&lt;/p&gt;
&lt;p&gt;This make sense?&lt;/p&gt;
 </description>
     <pubDate>Sun, 15 Sep 2002 19:35:57 +0000</pubDate>
 <dc:creator>akohl</dc:creator>
 <guid isPermaLink="false">comment 1114141 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/allow-zero-length-strings-field#comment-1114082</link>
    <description> &lt;p&gt;First off, NULL isn&#039;t the same as an empty string. Even though you might not allow empty strings you could still insert nulls.&lt;/p&gt;
&lt;p&gt;I wouldn&#039;t allow any empty strings and just leave the default value as (or insert) NULL.&lt;/p&gt;
&lt;p&gt;I&#039;m not 100% sure, but I think by marking the field as &quot;Required&quot; will force you to enter a value (NULLs won&#039;t be accepted)&lt;/p&gt;
 </description>
     <pubDate>Sat, 14 Sep 2002 07:06:46 +0000</pubDate>
 <dc:creator>Peter J. Boettcher</dc:creator>
 <guid isPermaLink="false">comment 1114082 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/allow-zero-length-strings-field#comment-1114056</link>
    <description> &lt;p&gt;Now I am really confused. If I choose &quot;no&quot; for &quot;allow empty string&quot;, that means that null values are also not allowed, or so I understood from your first post. But now you are saying that if I choose &quot;no&quot;, I will be able to test for nulls and very in one step if there is or is not a value in the field.&lt;/p&gt;
&lt;p&gt;But if I did not allow nulls, a listing without data in that field would never be written to the table in the first place.&lt;/p&gt;
&lt;p&gt;I thought that I would do the following;&lt;/p&gt;
&lt;p&gt;users&lt;br /&gt;
-----&lt;br /&gt;
userID&lt;br /&gt;
NameFirst&lt;br /&gt;
NameLastphone&lt;/p&gt;
&lt;p&gt;addresses&lt;br /&gt;
--------&lt;br /&gt;
addressID&lt;br /&gt;
street&lt;br /&gt;
city&lt;br /&gt;
state&lt;br /&gt;
zip&lt;br /&gt;
parentAddressID&lt;/p&gt;
&lt;p&gt;Users that have more than one address, would have a primary address, the one he wrote on his account registtation, and secondary addresses, which could be used a alternative ship to addresses.&lt;/p&gt;
&lt;p&gt;The listings where parentAddressID are null, are primary addresses. So should I allow empty strings in that field so that I can place a null value there? &lt;/p&gt;
&lt;p&gt;Another thing I&#039;m confused about is the &quot;required field&quot; choice. If I say yes, what&#039;s the difference between that and not allowing empty strings and nulls?&lt;/p&gt;
 </description>
     <pubDate>Fri, 13 Sep 2002 12:00:34 +0000</pubDate>
 <dc:creator>akohl</dc:creator>
 <guid isPermaLink="false">comment 1114056 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/allow-zero-length-strings-field#comment-1113998</link>
    <description> &lt;p&gt;Although this sounds simple, its a very tricky part of database design. Whether to use NULLS or allow empty strings. You definitely do not want to allow both since that makes your queries much more complicated.&lt;/p&gt;
&lt;p&gt;My preference is to not allow empty strings. That way if something is NOT NULL then you know for sure that there is data in it, without having to also check for the string length.&lt;/p&gt;
 </description>
     <pubDate>Thu, 12 Sep 2002 13:26:18 +0000</pubDate>
 <dc:creator>Peter J. Boettcher</dc:creator>
 <guid isPermaLink="false">comment 1113998 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/allow-zero-length-strings-field#comment-1113990</link>
    <description> &lt;p&gt;Actually it did help a little. I thought it meant that the field cannot have an empty srting. But it can have a null value.&lt;/p&gt;
&lt;p&gt;So if I want to filter a query, &quot;WHERE field1 IS NOT NULL&quot;, then I have to choose, &quot;allow empty string&quot;, right?&lt;/p&gt;
 </description>
     <pubDate>Thu, 12 Sep 2002 12:00:20 +0000</pubDate>
 <dc:creator>akohl</dc:creator>
 <guid isPermaLink="false">comment 1113990 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/allow-zero-length-strings-field#comment-1113971</link>
    <description> &lt;p&gt;It just means that the field can empty, null, zero length, etc.  As opposed to not empty, not null, and not zero length. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The ramification is just that you may have a field with nothing in it.&lt;/p&gt;
&lt;p&gt;I&#039;m sure that wasn&#039;t any help, sorry.&lt;/p&gt;
 </description>
     <pubDate>Thu, 12 Sep 2002 06:39:41 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1113971 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
