Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - Database Administration » SQL Anywhere database connections » Tutorial: Creating a SQL Anywhere database

 

Lesson 3: Setting a NOT NULL constraint on a column

Add a NOT NULL constraint to a column to prevent the column from allowing NULL values. By default, columns allow NULLs, but it is good practice to declare columns NOT NULL unless there is a reason to allow NULLs.

Prérequis

This lesson assumes that you have completed all preceding lessons. See Lesson 1: Creating a database file.

This lesson assumes that you have the roles and privileges listed in the Privileges section at the start of this tutorial: Tutorial: Creating a SQL Anywhere database.

 Task
  1. In the left pane of Sybase Central, double-click Tables.

  2. Click Products, and then click the Columns tab in the right pane.

  3. Click the ProductName column.

  4. Click File » Properties.

  5. Click the Constraints tab and click Values cannot be null.

  6. Click OK.

  7. Click File » Save.

Résultat

This constraint means that for each row added to the Products table, the ProductName column must have a value.

Suivant

Proceed to Lesson 4: Creating a foreign key.

 See also