Syncing complete database with server I am developing Point of sales software, which have multiple branches and one main branch. 
Main branch is web based while all other branches (9 now, which may exceed) are desktop based.
Client required that all branches must sync main branch whenever internet connectivity is available. 
So my question is that which sync functionality should i use?
I have not much idea about syncing as never work before on syncing.
Some of basic requirements are as follow:
Main branch can purchase or sell any item for any branch and stock + accounts will be hit.
Other branches can purchase and sale for them not for other branches but they can see other branches stock, their customers and accounts. 
Remote branch can move stock to any branch.
These are some basic requirements which may change according to clients wish.
So kindly guide me how can i sync complete data bases. Should i use my own logic or some builtin functions.
Thanks
Merge replication (link) might be a suitable solution for synchronising your data. Controlling the access so that your branches can only edit certain parts of the data should be controlled within your application.