Re: Unique consecutive number for id

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Saga" <antiSpam@xxxxxxxxxxx> wrote in message news:%23vGpOhTdKHA.6096@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for your input. I had a look at GUIs, but their huge char size makes them
unusable, at least for the scenario here. I found this article:

http://www.sqlteam.com/article/custom-auto-generated-sequences-with-sql-server

I am reading it now. It looks promising, but I need to do more research.

I am not really sure why the numbers have to be consecutive. This is the way
it has worked in the past, hence the reason for getting others' input so that I
can determine if something needs to be changed. Frankly, I am not even sure
if the current process being used now is the cause of the server timing out.

Again, thanks for your time and input. Regards, Saga




"John Bell" <jbellnewspostsNON@xxxxxxxxxxxxxxxxx> wrote in message news:ODglmXTdKHA.1156@xxxxxxxxxxxxxxxxxxxxxxx

"Saga" <antiSpam@xxxxxxxxxxx> wrote in message news:e7kMcyRdKHA.1652@xxxxxxxxxxxxxxxxxxxxxxx
Hello all, I would like your input on the following matter:

Application in VB6, using ADO 2.7, SQL Server 2000.

An application controls basic operation of a company, including the
assignment of a unique number to each of the shipments that it sends
out. The app, up to now, has been working fine; however, the company
has grown and will continue to grow. I would not be surprised if within
a year there would be 2,000 - 5,000 clients.

In some cases, the server times out and I have been tasked with the
project to overhaul, if necessary, the process that manages the unique
sequential shipping number. The requirements are:

a. Be a consecutive unique number
b. The number must increment by 1 every time that the current one is used.
c. Allow the administrator to define any seed (that is, the numbering
sequence can start at 1 or 4500 or whatever)
d. Be scalable to concurrent use by many users (as mentioned above)

What is the best way to do this? Any general ideas are welcomed, I will
do further research and testing. I am only looking to be pointed in the
best direction to fulfill the above objectives. Thank you for you time and
assistance. Saga


Hi

Why does the number have to be sequential and incrementing by 1? These two requirements make it difficult to implement an efficient scalable solution and are probably not absolutely necessary.

If you generate the numbers on a client or application server then you will have difficulty enforcing uniqueness and continuity e.g. what if one transaction rolls back after a different one has committed? Ignoring numerics and using GUIDs has it own problems, including the fact that random guids make a bad choice for indexes especially clustered ones. Using an Identity column requires that it is returned to the client and doesn't guarantee consecutive numbers.

John

The article you pointed to also asks the same questions I asked! The main criteria that is required that it is unique within a given time-frame, but that may be per customer or period and the full key may include other columns or prefixes.

John

.



Relevant Pages

  • Re: Unique consecutive number for id
    ... Application in VB6, using ADO 2.7, SQL Server 2000. ... sequence can start at 1 or 4500 or whatever) ... If you generate the numbers on a client or application server then you ... random guids make a bad choice for indexes especially clustered ones. ...
    (microsoft.public.sqlserver.programming)
  • Re: Threads, conditions, sockets, selects...
    ... Server is purely I/O bound, client on the other ... increments main threads sequence number and notifies main thread ... goes through the queue ...
    (comp.unix.programmer)
  • Threads, conditions, sockets, selects...
    ... Server is purely I/O bound, client on ... adds client + data to main threads queue and notifies main thread ... increments main threads sequence number and notifies main thread ...
    (comp.unix.programmer)
  • Re: TCP reset caused by socket.py
    ... The sequence numbers seem ok. ... Instead I see the server send data to the client and ... connection has been established when those RSTs come in. ...
    (comp.lang.python)
  • Re: Unique consecutive number for id
    ... Application in VB6, using ADO 2.7, SQL Server 2000. ... sequence can start at 1 or 4500 or whatever) ... Ignoring numerics and using GUIDs has it own problems, including the fact that random guids make a bad choice for indexes especially clustered ones. ... Using an Identity column requires that it is returned to the client and doesn't guarantee consecutive numbers. ...
    (microsoft.public.sqlserver.programming)