0

In intersystems cache, I have an existing table with example data as below

ID Name
1  Allen
2  Benny

I want to modify column ID so that it will be auto incremented. After adding this, if I insert charlie into the table then the id should be 3.

I think I have to use IDENTITY but not sure how to use it. Thanks for your help

Raja
  • 429
  • 4
  • 16

1 Answers1

0

If you want to change default ID column to anything else, you can use any other Property of class, and Index by this property which marked as IdKey. But, you have to manage incrementing this property by yourself. And You can do it with InitialExpression for setting value for any new object even if it will not be saved, or in %OnBeforeSave method, which will be called just before saving object.

DAiMor
  • 3,185
  • 16
  • 24