Differences

This shows you the differences between two versions of the page.

Link to this comparison view

identity_column [2021/04/05 11:23] (current)
Line 1: Line 1:
 +====== Identity Column ======
  
 +Identity columns are nice way to let the system generate unique ids for each inserted row in a table.
 +
 +By default the system doesn't let you insert a value into an identity column but you can override this.
 +
 +See [[https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/sqlp/rbafyinsertidentity.htm | Inserting values into an identity column]].
 +
 +===== OVERRIDING USER VALUE =====
 +If you want to the use the system generated values you can specify this on the SQL statement with ''OVERRIDE USER VALUE''.
 +
 +    INSERT INTO ORDERS OVERRIDING USER VALUE
 +        (SELECT * FROM TODAYS_ORDER)
 +
 +
 +===== OVERRIDING SYSTEM VALUE =====
 +If you want to the use the user provided values you can specify this on the SQL statement with ''OVERRIDE SYSTEM VALUE''.
 +
 +    INSERT INTO ORDERS OVERRIDING SYSTEM VALUE
 +        (SELECT * FROM TODAYS_ORDER)
 +
 +{{tag>ibm devel sql}}