Identity Column Specification

Identity column specification option

Grammar Syntax

<identity column specification> ::=
  GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY
      [ <left paren>  <common sequence generator options>  <right paren>  ]
<generation clause> ::=
  <generation rule>  AS <generation expression> 
<generation rule> ::=
  GENERATED ALWAYS
<generation expression> ::=
  <left paren>  <value expression>  <right paren> 
  
<common sequence generator options> ::=
  <common sequence generator option> ...
<common sequence generator option> ::=
    <sequence generator start with option> 
  | <basic sequence generator option> 
<basic sequence generator option> ::=
    <sequence generator increment by option> 
  | <sequence generator maxvalue option> 
  | <sequence generator minvalue option> 
  | <sequence generator cycle option> 
<sequence generator data type option> ::=
  AS <data type> 
<sequence generator start with option> ::=
  START WITH <sequence generator start value> 
<sequence generator start value> ::=
  <signed numeric literal> 
<sequence generator increment by option> ::=
  INCREMENT BY <sequence generator increment> 
<sequence generator increment> ::=
  <signed numeric literal> 
<sequence generator maxvalue option> ::=
    MAXVALUE <sequence generator max value> 
  | NO MAXVALUE
<sequence generator max value> ::=
  <signed numeric literal> 
<sequence generator minvalue option> ::=
    MINVALUE <sequence generator min value> 
  | NO MINVALUE
<sequence generator min value> ::=
  <signed numeric literal> 
<sequence generator cycle option> ::=
    CYCLE
  | NO CYCLE

Click here to go to the ANSI SQL Standard specification for this syntax.

Sample Source Patterns

Sample with GENERATED ALWAYS AS IDENTITY

Snowflake Output Code

Sample with GENERATED ALWAYS AS IDENTITY(INCREMENT BY)

Snowflake Output Code

Sample with GENERATED ALWAYS AS IDENTITY(MAXVALUE)

Snowflake Output Code

Sample with GENERATED ALWAYS AS IDENTITY(MINVALUE )

Snowflake Output Code

Sample with GENERATED ALWAYS AS IDENTITY(NO CYCLE)

Snowflake Output Code

Sample with GENERATED ALWAYS AS IDENTITY(START WITH )

Snowflake Output Code

Sample with GENERATED ALWAYS AS ROW START END

Snowflake Output Code

  1. MSCEWI1021: Node not supported.

  2. MSCEWI1048: Sequence Warning.

Last updated

Was this helpful?