How to sysnc the record from offline to online database ?

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
Varshini SAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David Christal CISSPCommented:
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
Varshini SAuthor Commented:
dchristal:  i need to achieve  this using program logic.
Can you give me some different logics to achieve  this ?
David Christal CISSPCommented:
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?
Varshini SAuthor 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 ?
David Christal CISSPCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.