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 » Queries and data modification » Data manipulation statements » Addition of data using INSERT » Value insertion into specific columns

 

Inserting values into specific columns

You can add data to some columns in a row by specifying only those columns and their values.

Prerequisites

You must have INSERT privilege on the table. If the ON EXISTING UPDATE clause is specified, UPDATE privilege on the table is also required.

Context and remarks

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.

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.

 Task
  • Execute an INSERT INTO statement to add data to specific columns.

    For example, the following statement adds data in only two columns, DepartmentID and DepartmentName:

    INSERT INTO GROUPO.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.

Results

The data is inserted into the specified columns.

 See also