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 - SQL Usage » Data integrity » Table and column constraints

 

Adding a UNIQUE constraint

You can create and drop UNIQUE constraints for columns in Sybase Central.

Prérequis

You must be the owner of the table or have one of the following privileges:

  • ALTER privilege on the table and either the ALTER ANY INDEX, COMMENT ANY OBJECT, CREATE ANY INDEX, or CREATE ANY OBJECT system privilege
  • ALTER ANY TABLE system privilege and either the ALTER ANY INDEX, COMMENT ANY OBJECT, CREATE ANY INDEX, or CREATE ANY OBJECT system privilege
  • ALTER ANY OBJECT system privilege

Contexte et remarques

Spatial columns cannot be included in a UNIQUE constraint.

For a column, a UNIQUE constraint specifies that the values in the column must be unique. For a table, the UNIQUE constraint identifies one or more columns that identify unique rows in the table. No two rows in the table can have the same values in all the named column(s). A table can have more than one UNIQUE constraint.

 Task
  1. In Sybase Central, use the SQL Anywhere 16 plug-in to connect to the database.

  2. In the left pane, double-click Tables.

  3. Click the table you want to alter.

  4. In the right pane, click the Constraints tab.

  5. Right-click in the Constraints tab and click New » Unique Constraint.

  6. Follow the instructions in the Create Unique Constraint Wizard.

Résultat

A UNIQUE constraint is created.