222
Views
4
Comments
Solved
Default value for the id attribute of an entity

What could possibly be the use of having a default value for the id attribute (which also serves as primary key) of an entity?

2026-02-26 06-29-24
Rahul
 
MVP
Solution

Hi Nishit,

When you set entity attribute as primary key and Auto_number than no need to save any default value (and does not work in this case) but 

if not set auto-number than set default value and when you not pass value from your logic it set delfult value but 

Primary key is always Unique.

IF Entity attribute is other than primary key then you can set default value like-datetime column for currdatetime,

text for "Default Value",Integert for 0



Hope this will help you.


Regards

Rahul Sahu

2026-02-26 06-29-24
Rahul
 
MVP
UserImage.jpg
Nishit Sadual

Hi Rahul ,

Thanks for you reply. 


But my question was: Since the id can be set as auto-numbered , what is the use of having a default value for it?

Because when it is auto-numbered , we do not need to set a value anyway?

2026-02-26 06-29-24
Rahul
 
MVP
Solution

Hi Nishit,

When you set entity attribute as primary key and Auto_number than no need to save any default value (and does not work in this case) but 

if not set auto-number than set default value and when you not pass value from your logic it set delfult value but 

Primary key is always Unique.

IF Entity attribute is other than primary key then you can set default value like-datetime column for currdatetime,

text for "Default Value",Integert for 0



Hope this will help you.


Regards

Rahul Sahu

UserImage.jpg
Nishit Sadual

Thanks Rahul

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.