This sounds more feasible and very practical Glenn. What would be the performance, say, on a network with 20 users and 100,000 invoices already in the database.
I'm using master-detail ADO components, which means I could store a temporary invoice number in the invoice and when the user clicks save invoice, I generate the next invoice number and use it when committing the transaction. Phil --- In [email protected], "Glenn B. Lawler" <[EMAIL PROTECTED]> wrote: > > > Using the max(invoiceno) method has worked for me quite well for > > desktop applications. However, I'm developing client/server (MS SQL > > Server) and my fear is that users will be colliding when they > > retrieve the same invoiceno and try to save. > > Virtually all the work we do is with Client/Server databases. That is why I > mentioned the "transaction capability". A transaction is a group of > statements sandwiched between a BEGIN TRANSACTION and ended with either a > COMMIT TRANSACTION or ROLLBACK TRANSACTION. All the statements within the > transaction are rolled back (or undone) if errors occur. > > This tranaction feature is one of the primary features that defines a full > RDBMS. > > Furthermore, a transaction is a single unit of work, meaning no other user > can make any changes to the database until your transaction is complete. > This is one of the reasons it is important to design your transactions so > they complete quickly. > > Another feature of a Client/Server RDBMS is that they "serialize" > transactions. > > So, if you execute a number of statements in a SQL batch, such as finding > the next InvoiceNo, followed by inserting the record, you can be guaranteed > no other user will be able to be doing this on the same table at the same > time. > > Given these features, there is really no need to store the keys in a table. > > Glenn Lawler > ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/i7folB/TM --------------------------------------------------------------------~-> ----------------------------------------------------- Home page: http://groups.yahoo.com/group/delphi-en/ To unsubscribe: [EMAIL PROTECTED] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/delphi-en/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

