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:
00743558
Views:
10
>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
Jon Rosenbaum
Devcon Drummer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform