Newbie In SQL Replication`

Hi all,
I've an SQL Server on my main site with a local Program that works with it and everything works fine.
My second site in in another country and because of a latency problems i want to set up another SQL server in my second site and replicate between them. the problem is that both site needs to work on the same tables.
i fear the if the connection between the two sites will be down and both sites will update the same table and then the connection will be up again and it won't be able to replicate anymore because both servers has data in the same table in the same line but it will be different..

any idea what to do?

Great article here: https://technet.microsoft.com/en-us/library/ms152565(v=sql.105).aspx

You'll probably want Peer to Peer https://technet.microsoft.com/en-us/library/ms151196(v=sql.105).aspx

but have you considered an availability group with asynchronous replication?

https://msdn.microsoft.com/en-us/library/ff877884.aspx

Using Database mirroring, is high-safety mode which quickly brings the standby copy of the database online (without data loss). You may have a look on this link things to remember in database mirroring.

AlwaysOn Availability Groups have replaced mirroring, though it is still supported for now. It will become unsupported at some point,

see https://msdn.microsoft.com/en-us/library/ms143729.aspx?f=255&MSPPError=-2147217396

You should also check the link provided by me. In that discussed about this.

Sure, though these days I don't recommend mirroring or even mention it unless asked specifically, given its life expectancy