Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Generate column with an increment of -1??
Sat, Nov 26 2022 1:57 AMPermanent Link

Ian Branch

Avatar

Hi Team,
Can I create a 'autoinc' column which 'increases by -1?
I need the ID field to go -1, -2, -3, etc.

Regards & TIA,
Ian
Sat, Nov 26 2022 7:24 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


I don't think you can but if you don't mind a bit of redundancy you could create a GENERATED or COMPUTED column and reference that.  A computed column wouldn't take up any more disk space and (I think) should not be susceptible to change by the user. Don't know if it can be used as the primary key but it can be used in an index.

Another alternative if to have a before post trigger which calculates a value for you - the only issue is maintaining the net id number.

Finally, if its just for display purposes, simply define a descending index using the normal autoinc.

Roy Lambert
Image