How to set auto increment field while creating table in celonis sql, since identity is not working
Page 1 / 1
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
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.