내 커뮤니티 업적 표시줄을 확대합니다.

Submissions are now open for the 2026 Adobe Experience Maker Awards

Mark Solution

활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.

해결됨

Primary key is not incremented correctly in the custom schema

Avatar

Level 1

Dear Community's Leaders,

 

I have created custom schema but auto primary key is not incremented correctly.

Sathyam999_0-1699335853759.png

schema structure: I have used auto pk true

Sathyam999_1-1699335948483.png

 

I tried community suggestion to solve this issue through workflow using SQL code activity, still I am getting error. 

 

Sathyam999_2-1699336166912.png

 

SQL:

Sathyam999_0-1699336512469.png

 

 

 

Sathyam999_3-1699336202750.png

 

 

Can you please help me this.

 

 

 

 

1 채택된 해결책 개

Avatar

정확한 답변 작성자:
Community Advisor

Hello @Sathyam999 

 

You have shared 2 screenshots form 2 different instances.

 

I assume the one attached in the main thread is from production env. You are using the custom sequence where it should work. Try, removing the Key and deindex attributes. The keys are also indexed and since you are using autopk, you don't have to define the primary key.


     Manoj
     Find me on LinkedIn

원본 게시물의 솔루션 보기

4 답변 개

Avatar

Community Advisor

Hi @Sathyam999 

 

As using the SQL script you have already assigned the first key with 0 value, hence while using insert or update activity you are getting this duplicate error. Could you try insert a record manually either by SQL script or Javascript, and then try to insert using the activity.

 

Regards

Akshay

Avatar

Level 1

Hi @AkshayAnand ,

Thank you for your response,

 

when I enter the values into the schema through SQL code, data inserted correctly into the data base but primary key is not incremented properly, when I enter data manually in the form.

It is incremented randomly not sequentially like 1,30,60,90..

 

when I enter the data into the schema, it should be updated 1,2,3 like this, can you please tell if there is any other solution.

I have used autopk="true" in the schema

Sathyam999_0-1699359984481.png

 

Regards

Sathyam

Avatar

Community Advisor

Hi @Sathyam999 ,

 

The solution for the Incrementing gap for autopk is given in the below thread , where David had explained why there would be a gap of 30 for each Increment. Please refer to the below thread, you can replace the function used to generate the Sequence. Although there can be a risk during the bulk Inserts/Updates if there is an Increment of 1, as all the sequences should be assigned to bulk data at once.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-campaign-classic-questions/autopk-in-the-sche...

 

Regards,

Pravallika.

 

 

Avatar

정확한 답변 작성자:
Community Advisor

Hello @Sathyam999 

 

You have shared 2 screenshots form 2 different instances.

 

I assume the one attached in the main thread is from production env. You are using the custom sequence where it should work. Try, removing the Key and deindex attributes. The keys are also indexed and since you are using autopk, you don't have to define the primary key.


     Manoj
     Find me on LinkedIn