Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to deal with updatable copies of a database
Message
From
28/08/2002 07:52:13
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
27/08/2002 16:53:02
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00694241
Message ID:
00694368
Views:
13
>What is the recommended way to design a database to deal with the following situation:
>
>A school system has a central database. Data is entered at member schools either directly into the master DB or into detached copies of the master DB. If copies are used, they are to be synchronized periodically with the master DB.

Assign each school a unique number. Store it in variable gn_SchoolNumber.

Have a function SerialNumber() that, each time it is run, gets the next available number from a table of sequence numbers.

Make the primary key of each table where you need this functionality bintoc(gn_SchoolNumber, 2) + bintoc(SerialNumber("TableName")).

This way, you require 6 bytes for each PK and FK. As a comparison, an integer-only key needs 4 bytes, a GUID requires 16 bytes.

Saludos, Hilmar.
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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform