Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Generating unique Order No
Message
De
17/06/2009 16:07:02
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01406619
Message ID:
01406731
Vues:
39
This message has been marked as a message which has helped to the initial question of the thread.
>>>Hi everybody,
>>>
>>>I have an application that looks like it was converted from 2.6 at some point and then moved to VPM 6.0
>>>
>>>The tables are in the database, but not really properly normalized. The Orders table has OrdNo field (Numeric 7), which I believe is supposed to be a PK in this table. I'm not sure how exactly it was populated originally.
>>>
>>>The question is - how can I generate the unique Order No ? I don't know if it would be a good idea to introduce counter table to this existing application?
>>>
>>>Any ideas here? I've searched the whole project and I don't see a single INSERT command involving OrdNo field - it is probably done with APPEND BLANK and REPLACE.
>>>
>>>Thanks in advance.
>>
>>What would be the trouble with having a counter table? Just keep the last number used, or the next number to use, for several sequences. One record for each sequence you need.
>>
>>To assign the number in a multiuser environment, you don't know whether the current user will save or undo the record, or whether another user will save first. So you only assign the number when the user tries to save. If the save fails, undo everything (with a transaction).
>
>I guess I'm just too lazy - thus I went with Peter's suggestion from another thread.

In any case, only assign the number when the record is saved.

If you need code for getting a sequence from a sequence table, I can search for mine.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform