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

SQL Anywhere 12.0.0 » SQL Anywhere Server - SQL Usage » Querying and modifying data » Adding, changing, and deleting data » Adding data using INSERT


Inserting values into specific columns

You can add data to some columns in a row by specifying only those columns and their values. Define all other columns not included in the column list to allow NULL or have defaults. If you skip a column that has a default value, the default appears in that column.

Adding data in only two columns, for example, DepartmentID and DepartmentName, requires a statement like this:

INSERT INTO Departments ( DepartmentID, DepartmentName )
VALUES ( 703, 'Western Sales' );

DepartmentHeadID does not have a default value but accepts NULL. therefore a NULL is automatically assigned to that column.

Cancel these changes to the database by entering a ROLLBACK statement:


While the column order you specify does not need to match the order of columns in the table, it must match the order in which you specify the values you are inserting.

 Inserted values for specified and unspecified columns
 Restricting column data using constraints
 Explicitly inserting NULL
 Using defaults to supply values