Adaptive-Server-generated values for IDENTITY columns

When you insert a row into a table with an IDENTITY column, Adaptive Server automatically generates the column value. Do not include the name of the IDENTITY column in the column list or its value in the values list.

This insert statement adds a new row to the sales_daily table. The column list does not include the IDENTITY column, row_id:

insert sales_daily (stor_id)
values ("7896")

NoteYou can omit the column name stor_id. The server can identify an IDENTITY column and insert the next identity value, without the user entering the column name. For example, this table has three columns, but the insert statement gives values for two columns, and no column names:

create table idtext (a int, b numeric identity, c char(1))
-------------------
(1 row affected)

insert idtext values(98,"z")
-------------------
(1 row affected
insert idtest values (99, "v"))
--------------------

(1 row affected)
select * from idtest
---------------------
98     1        z
99     2         v

(2 rows affected)

The following statement shows the row that was added to sales_daily. Adaptive Server automatically generates the next sequential value, 2, for row_id:

select * from sales_daily
where stor_id = "7896"
sale_id      stor_id
-------      -------
      1      7896 
 
(1 row affected)