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

ID: Q130244

3.00 WINDOWS kbprg kbprb

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 reference words: 3.00 VFoxWin KBCategory: kbprg kbprb KBSubcategory: FxprgTable

Keywords          : FxprgTable 
Version           : 3.00
Platform          : WINDOWS


Last Reviewed: May 1, 1996
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.