Sample Header Ad - 728x90

generate unique primary key for all clients from the local database and NOT the server

0 votes
1 answer
160 views
I'm using MySQL Innodb database to work as a distributed database among many places and also each place will work offline but at the end all the data will be centralized in one server, I want to generate a unique primary key for registration table that will be unique for all clients, first I thought about int auto_increment but then I realized that this will cause conflict between each client as all of them will generate a new auto_increment from their local database and not from server so in this case all will start from 1 and increment for each new register
now I'm thinking of using a CHAR or VARCHAR to put a prefix for each registration in client's local database, or is there another way to do so?
Asked by Bayar (101 rep)
Aug 31, 2016, 06:49 AM
Last activity: Dec 2, 2021, 05:06 AM