Re: Incrementing sequence number
Posted in 2000
From: Bytebrothers (UK) <kwillis@dial.pipex.com> > >OK, you've all come across this scenario I'm sure, so can someone save >me having to reinvent this particular wheel, please? > >You've got this table which stores, among other things, a name and a >sequence number within name: > >Annie 1 >Annie 2 >Annie 3 >Bob 1 >Bob 2 >Carol 1 >Carol 2 >Carol 3 >etc > >Now I need to insert a new row for 'Annie'. I need to select the >maximum sequence number currently in use for this name, increment it, >and insert my new row with the newly incremented sequence number. > >How the devil do I do this from ESQLC in an atomic fashion, ie. how do >I ensure that no-one reads the max sequence after I have read it but >before I have inserted my new row? Lock the "max" record? ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com