Поделиться через


How to: Modify Null Options on Columns

For each column in your table, you can specify whether to allow or disallow null values. A null value, or NULL, is not the same as zero (0) or blank; NULL means that no entry has been made. Its presence usually implies that the value is either unknown or undefined. For example, a null value in a price field of a titles table would not mean that the book has no price, but that the price is unknown or has not been set.

If null values are not allowed, the user entering data in the table must enter a value in the field or the record cannot be accepted in the database.

Note

You cannot change this property on a primary key column. Also, identity columns cannot have null values. That is, you cannot create or modify a column so that its Identity setting is Yes and its Nulls Allowed setting is also Yes.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To modify the null options on a column

  1. In Server Explorer, right-click the table with null options you want to modify and click Open Table Definition.

    The table opens in Table Designer.

  2. Select the column and in the Column Properties tab either clear or check the Allow nulls check box.

The new value for the Allow nulls check box is assigned to the column in the Table Designer after you click outside the grid cell or use the TAB key to move to another grid cell. It takes effect in the database when you save your changes in the Table Designer.

See Also

Reference

Column Properties

Other Resources

Working with Columns