Skip to content

DF_FIELD_NULL_ALLOWED

Does a field support having the “NULL value”?

Level

Column

Supported by

The DataFlex SQL Drivers (SQL Server, DB2, and ODBC) and the Pervasive.SQL Driver.

Type

Boolean, permanent

Access

Read / Write

Values

  • True
  • False

Syntax

Use cli.pkg
Get_Attribute DF_FIELD_NULL_ALLOWED of {tableNumber} {columnNumber} to {BooleanVariable}
Set_Attribute DF_FIELD_NULL_ALLOWED of {tableNumber} {columnNumber} to {True|False}

Remarks

This attribute indicates whether a column allows "null values" to be stored. The attribute is true when a column allows null values and false otherwise. A null value is a special marker that is used when the value of a column is unknown. See NULL Values and Defaults for more information.

This is a permanent attribute that can only be set inside a Structure_Start ... Structure_End operation.

To place the “Null value” in a column and to see if a column contains the “Null value,” use the DF_FIELD_IS_NULL column attribute.

Example

Procedure ShowNullAllowed Handle hTable
    Integer iNumColumns
    Boolean bAllowed
    Integer iColumn
    String sTable
    String sColumn

    Get_Attribute DF_FILE_ROOT_NAME Of hTable To sTable
    Showln "The columns in table " sTable " have NULL settings:"
    Get_Attribute DF_FILE_NUMBER_FIELDS Of hTable To iNumColumns

    For iColumn From 1 To iNumColumns
        Get_Attribute DF_FIELD_NAME Of hTable iColumn To sColumn
        Get_Attribute DF_FIELD_NULL_ALLOWED Of hTable iColumn To bAllowed
        Show (Right("    " + String(iColumn), 5)) ": " sColumn
        Showln "  " (If(bAllowed, "NULL", "NOT NULL"))
    Loop
End_Procedure

This example shows the null allowed setting for all columns of a table.