We have 2 branches B-1 and B-2 within the distance of 100kms. Both these Branches have their own SQL server setup in their respective locations ;with same database name, tables and structure... Means both these servers has same Database and table Schema.

B-1 is functional since 2017. And hence we consider it as Master Server wherein we have designed hundreds of reports and provides the complete statistics and operational reports.

B-2 is recently setup and the problem is that here, we have very limited source of electricity infact no electricity supply at all. And hence we run the server + user PC's using Generators (for 8 hours continiously).
The nature of the work in both these branches are the same.

My problem is that, It is highly impossible for me to merge these two servers due to Non VPN Availibily and I am having a very difficult time to retireive the reports from both these locations together.I want to transfer the newly inserted/edited data from the B-2 to the database of B-1 (Master Server). Due to security issues, we cannot go for Public IP either. The resource i have is only internet connectivity.

What I am planning is like uploading the newly added/edited data file from the B-2 server (2 tables) to FTP server and then I want to insert the contents of the file from the FTP Server into the B-1 Server and delete that file from FTP.

Hence I need:

1. Sql Script to write table result (newly added/edited) to a file (ex: abcFileName)
2. Sql script to insert data into a table from the above file(Ex: abcFileName).

Note: If i get the script for my above needs, then i will automate them via batch file or via .NET/C# application to Send the file (from B-2) and receive the file(at B-1).

Please note: The Source and Destination Table structures are 100% same and without any differences.

Please do not provide SSMS solution (as I am planning to automate my queries and without user assistance)

Thanks in Advance.

Since Arabic fonts weren't siaplying in the .txt file, I switched to .csv file. and this is my workaround query:

```
    DECLARE @ExportSQL nvarchar(max);
SET @ExportSQL = 'EXEC ..xp_cmdshell ''bcp "SELECT TOP 5 * from Transport.dbo.Test_Table " queryout "D:\results4.csv" -T -c -t -S ABDULLAH-PCNEW'''

Exec(@ExportSQL)

```

I get the below CSV file but with all the SQL table fields under one Excel column.

[![enter image description here](https://i.stack.imgur.com/6GmFm.png)](https://i.stack.imgur.com/6GmFm.png)

Appreciate all your comments/suggestions. Actually I would not prefer to call it as a Synchronize request.... Instead I can say like it is a Push and Read the effected data from one location to another (not vice versa)..
Ex: Lets assume,
B-1 Server has 100,000 rows already.
B-2 Server has 5 rows in it.

Work Operation on Date: 02-10-2020
B-1 Server = Saves 10 new rows.
B-2 Server = Saves 200 New Rows.

End of the Day I need as follows:
B-1 Server = 100,210 rows
B-2 Server = 205 Rows