From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,a08d3b69b39ca00b,start X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,a08d3b69b39ca00b,start X-Google-Attributes: gid1164f8,public X-Google-Thread: f8dc0,a08d3b69b39ca00b,start X-Google-Attributes: gidf8dc0,public From: E.Havelaar@Regy.Canterbury.Ac.NZ (Ed Havelaar) Subject: Generating unique numbers Date: 1995/12/11 Message-ID: <4aic03$3u1@cantua.canterbury.ac.nz>#1/1 X-Deja-AN: 121564474 content-type: Text/Plain; charset=US-ASCII organization: Information Services Section, University of Canterbury mime-version: 1.0 newsgroups: comp.databases.rdb,comp.sys.dec,comp.os.vms We have an RdB database on top of VAX VMS (soon to migrate to Alpha) for which I need to generate a unique account number whenever I create a new record. I wonder if anyone has any experience on what the best way to do this is. Options that have crossed my mind are: [1] Write some SQL procedure which grabs MAX(ACC_NO), adds 1, and inserts a record using this value as its new ACC_NO. Presumably locking / re-entrancy problems could be taken care of by using the right type of transaction -- my guess: set transaction read write wait reserving