Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Way to create unique ID
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00743532
Message ID:
00743564
Views:
9
Thanks, John. Would not work in my particular situation, but it's helpful anyway.

Here is the solution I implemented in the meantime, though I don't like it:

I go bottom in the BldMstr file and pick up the last RecNum+1. Do the same in Source table and then pick up the maximum between two numbers... Since it's a single user application, this should work, but it doesn't account for deleted records (though I may switch deleted as well)...

>>Can you advise something in my situation, please?
>
>Nadya,
>
>I'll describe what we do and you can see if that will be helpful to you at all.
>
>We have a few children tables that need their own unique id values for primary keys, etc. What we did was create numeric columns in our one-record system table that correspond to each of the children tables. Each of these columns contain the next unique ID number that is to be used for that particular table. When it comes time to insert, we call a stored proc that we created called GetUniqueID(), passing it the column name. This procedure uses the system table again under a different alias so as to get the most recent copy of that table, retrieves the correct next ID, increments the ID, locks that record, and stores the new ID back to the column.
>
>Hope that's helpful.
>
>Laterness,
>Jon
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform