c# - How to maintain uniqueness of primary key column in multiple client single server application -


i have found number of different questions on generating uid, couldn't satisfied requirements, please find below business requirement.

our application has main database resides on sql server on server. have same application hosted on clients machine same database structure available on server. client application runs on local machine , updates data on local machine database after every 15 minutes client machine database sync server machine database , updates data on server database.

currently, have implemented int primary key auto identity true. let client 1 , client 2 generating same primary key example "1,2,3.. on" on local database so, when data sync server database conflict primary unique constraint.

so, question how on come scenario. how generate unique key globally unique without duplication. per knowledge related guid. in scenario, guid going generate different machine there possibility of duplication of guid.

please me out best solution can implement achieve uniqueness different machine.

solution:

it know sql server type is, regardless sql servers have feature called auto increment can applied column , automatically select column value based on previous ids. in application have private integer accessible threads contains last used id. either should work.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -