KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q130244: PRB: All New Field Values Set to .NULL. When You Modify Table

Article: Q130244
Product(s): Microsoft FoxPro
Version(s): WINDOWS:3.0
Operating System(s): 
Keyword(s): 
Last Modified: 10-FEB-2000

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual FoxPro for Windows, version 3.0 
-------------------------------------------------------------------------------

SYMPTOMS
========

After executing the ALTER TABLE command to add a new field to a table or after
modifying a table manually, all of the field values for a new field are set to
.NULL. for each record in the table.

CAUSE
=====

This behavior occurs if NULL is set ON by using the SET NULL command.

RESOLUTION
==========

Issue the SET NULL OFF command before executing an ALTER TABLE command or before
modifying a table manually when using the Database Container.

STATUS
======

This behavior is by design.

MORE INFORMATION
================

Steps to Reproduce Behavior
---------------------------

1. From the Command window, issue the following commands:

     SET NULL ON
     CREATE DATABASE mydata
     CREATE TABLE mytable (cFld1 C(20))
     APPEND BLANK
     REPLACE cFld1 WITH "Hello"
     BROWSE

2. Browse the table to view the first record, and note the table structure. Then
  modify the table with an ALTER TABLE command:

     ALTER TABLE mytable ADD COLUMN cNewfld C(20)
     BROWSE

Now the field value for cNewfld holds the value .NULL..

NOTE: Placing NOT NULL at the end of the ALTER TABLE command doesn't work if SET
NULL is ON. Instead, the error message "Field NEWFLD does not accept null
values" is displayed, and the field is not added.

Additional query words: VFoxWin

======================================================================
Keywords          :  
Technology        : kbVFPsearch kbAudDeveloper kbVFP300
Version           : WINDOWS:3.0

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.