Re: New database squence number & locking info
- From: Robert Berman <ThornmastrSpamKiller@xxxxxxxxxxxxx>
- Date: Sun, 26 Jun 2005 13:40:37 GMT
[posted and mailed]
"JoeO" <jp3BlessNoSpam@xxxxxxxxxxx> wrote in
news:eOsMuHdeFHA.2984@xxxxxxxxxxxxxxxxxxxx:
> Hi Bob
> The original post was... the poster increments the primary key by
> adding 1 to the last primary key when adding a new record. I did
> assume then the primary is non autonumber field.
> He/she was doing
> "Select * from tblX"
> then Movelast
> then increment primary key by 1
> then add new
> He/she was opening the whole table just to a new record.
>
> Then I suggested
> Getting the top1 (sorted by Primary Key and the increment by 1)
> Then add New
>
> Select * where from YourTable where primary < 1 will not work... how
> then will he increment the primary key by adding 1
> Unless of course there is some kind of StoredProcedure that will
> handle incrementing the non autonumber primary key field...
> Please refere to the original post...
Hi Joe,
Yes, I should have read the OP's post but I derived something obviously
erroneous from not reading it; that the primary key was an autonumber.
One of the things this opens is the concept of keys, specifically, what
really is the purpose of a primary key, and should the user ever even
see it. In my opinion, the entire purpose of a "primary key" is for a
very fast look up. As such, the programmer has neither the need nor the
inclination to fool with it. The most flagrant example I can think of is
the typical billing program which uses the invoice number as a primary
key (again, remember I am referring to an ACCESS database) and the
programmer controls it by adding one to the current invoice number.
Which, I guess is fine, if a second user doesn't update his simultaneous
to the first user. To me, the ideal situation is to let ACCESS control
the primary key which frees the OP to control other keys, such as
invoice number.
More importantly, and more perhaps to the OP's question, he can maintain
a separate table containing the last valid key.
.
- Follow-Ups:
- References:
- New database squence number & locking info
- From: The Prof.
- Re: New database squence number & locking info
- From: JoeO
- Re: New database squence number & locking info
- From: The Prof.
- Re: New database squence number & locking info
- From: JoeO
- Re: New database squence number & locking info
- From: Robert Berman
- Re: New database squence number & locking info
- From: JoeO
- New database squence number & locking info
- Prev by Date: Re: How to locate errors when changing language
- Next by Date: Re: How to locate errors when changing language
- Previous by thread: Re: New database squence number & locking info
- Next by thread: Re: New database squence number & locking info
- Index(es):
Relevant Pages
|