Skip to main content
Question

How to set auto increment field while creating table in celonis sql

  • April 7, 2022
  • 1 reply
  • 12 views

How to set auto increment field while creating table in celonis sql, since identity is not working

1 reply

janpeter.van.d
Level 12
Forum|alt.badge.img+26

Hi @Amit Singh, do you mean that you want to have an identifier column that increments for every row? You can use the following code in SQL:

 

SELECT

    xx AS "_CASE_KEY"

    , yy AS "EVENTTIME"

    , row_number() OVER ( PARTITION BY "xx" ORDER BY "yy" ASC) AS "RANK"

FROM "table_name"

 

In this example you create an incremental ID per Case, ranked on Eventtime. For more information, read the Vertica manual: https://www.vertica.com/docs/latest/HTML/Content/Authoring/SQLReferenceManual/Functions/Analytic/RANKAnalytic.htm