Skip to main content

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

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


Reply