Re: Next Serial value ?
Posted in 1998
It would be bad practice to figure out the serial # before inserting. If you did this another process could insert a record and get the serial # you think you will get. Also MAX(field)+1 is not guaranteed to return what the next value would be. Think about what would have happened if the last 10 records INSERTED we deleted. If you still want to get the next number before hand, I believe you could try selecting from systables? Eric Weaver wrote in message <35E85F49.88B8A4D8@intelihealth.com>... >Is there anyway to determine the next serial value to be used for a >specific table (without selecting max(<col>)+1). I figure this value >must be stored in a system table somewhere right? The server doesn't do >the max+1 calculation each time does it? > >I need this value BEFORE the insert so that I can use it to create a >hashed 24 byte code from it - then do the insert. Otherwise, I have to >do the insert, get the serial value, create my hashed code, and then do >an update. It would be more efficient to know the serial value before >hand. > >Any help would be appreciated. > >Thanks, >Eric Weaver, InteliHealth S.W. wilcoxon@pioneerplanet.infi.net