Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Algorithm for generating unique value for the 6 char fie
Message
From
04/05/2001 13:35:32
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00503649
Message ID:
00503652
Views:
27
Yup. Generate the value and use INSERT INTO instead of APPEND BLANK. Create the PK value before the INSERT.


>Hi everybody,
>
>I have a table, there field Code (Character 6) is made PK. This table contains one blank record (this is by design). Now, each time I'm issuing append blank, I get an Error "Uniqueness of indexes is violated". I'm thinking about adding a default value for this field, but I don't want to use NextID table approach, because this database doen't have a NextID table and I don't want to change it.
>Therefore I'm seeking for the idea of a function, which will generate Unique ID automatically (Char 6).
>
>Or may be you have other ideas? Simple way, which was suggested by my manager, just make this index to be regular and deal this checking on the form level. I disagree, because our data is not secure enough, so if somebody will edit this table directly, there is a chance for adding duplicates.
>
>What do you think? I know, it's not recommended to use character PK (meangful), but this table was designed long time ago and I don't want to change it.
>
>Thanks in advance.
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform