Null Value (.NULL.) Is a Marker - Not a Data Type

Last reviewed: August 2, 1995
Article ID: Q133740
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 3.0

SUMMARY

The null value (.NULL.) is not an actual value, it is a marker that denotes that a memory variable or a field value is missing or unknown. If .NULL. is assigned to a field or a variable, the field or variable's data type is not changed, but the value is changed to NULL.

MORE INFORMATION

Steps to Demonstration Behavior

The .NULL. value can be assigned to variables that are numeric or character as demonstrated by these steps:

  1. From the Command window, issue these commands:

       nMyvariable=200        && and press ENTER
       ? TYPE("nMyvariable")  && and press ENTER
       ? nMyvariable
    
       The N is displayed for nMyvariable denoting a variable of numeric type.
    
    

  2. To assign a null value (.NULL.) to nMyvariable, issue the following commands in the Command window:

       store .NULL. to nMyvariable        && and press ENTER
       ? TYPE("nMyvariable")              && and press ENTER
       ? nMyvariable                      && and press ENTER
    
       The value N is displayed followed by .NULL.; the type of the variable
       did not change but the value did.
    
    

  3. To assign a character string to the variable and check the variable type, issue the following commands in the Command window:

       cMyvariable="This is a String"     && and press ENTER
       ? cMyvariable                      && and press ENTER
    
       The screen displays the string "This is a String."
    
    

  4. Issue the following command in the Command window:

       ? TYPE("cMyvariable")              && and press ENTER
    
       The screen displays C denoting a character type.
    
    

  5. Issue the following commands in the Command window:

       STORE .NULL. TO cMyvariable        && and press ENTER
       ?TYPE("cMyvariable")               && and press ENTER
    
       The screen displays C to show that the type has not been changed.
    


Additional reference words: 3.00 VFoxWin
KBCategory: kbprg
KBSubcategory: FxprgGeneral


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.

Last reviewed: August 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.