How to  sysnc the record from offline to online database ?

Varshini S
Varshini S used Ask the Experts™
on
I have a sales record(s) in my SQL offline database

sample record:
Tran#    Loc#      Date                Item#   SaleAmt
2345      5            20151205       542         250.00


How do i  sync this record to online DB ?  please provide me 3 to 4 different methods
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
1. I use Red Gate SQL Compare, but it's somewhat expensive
2. Link (temporarily?) the online and offline databases and write queries.
3. Create an Azure database and use its SQL Sync feature.
4. https://code.msdn.microsoft.com/Database-SyncSQL-Server-e97d1208
5.Move data via import and export, then merge appropriately
6. Other sync vendors: Idera, sqlaccessories.com, cloud-elements.com

Author

Commented:
dchristal:  i need to achieve  this using program logic.
Can you give me some different logics to achieve  this ?
I need to better understand what you want to happen:
Do you want to update your local record?
                            Update the online database with this information?
                            Insert this as new information to the online database?

which record to you want to prevail? the online version or your local version?
Are you wanting to sync just one record or all of the records in both tables?

Author

Commented:
Scenario:

System went offline while user doing  transaction. So all the transactions went to offline database.
System needs to sync all the offline records to online db once the connection is restore. what are the different ways to achieve this ?
first: update production from offline where appropriate

update production  set [Loc#] = o.[Loc#], [Date] = o.[Date], [SaleAmt] = o.[SaleAmt}
from production p inner join offline o on p.[Trans#] = o.[Trans#]


second: insert missing offline records
assumptions: Many

insert into production ([Tran#], [Loc#] ,[ Date] ,[ Item#],[SaleAmt])
select [Tran#], [Loc#] ,[ Date] ,[ Item#],[SaleAmt] from offline
left outer join production on offline.[Tran#] = production.[Tran#] where p.[Tran#] is null

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial