I used the following command for restoring a database:

RESTORE DATABASE TorqueNet 
FROM DISK = 'C:\Backup.bak';
GO

This command deletes the existing data and performs a complete data replacement.

Instead of that, I want to append new data and replace existing records if there are any changes but keep existing data.

1 Answers

1
Darkking122 On Best Solutions

If I understand you, no you cannot. A database restore will overwrite the destination.

It sounds like you are wanting to merge one database into another, which can be done with 3rd party tools.

You would need to

  1. Restore the backup to another database
  2. Merge the newly restored database into the current database.

If this is a task that you need to repeat, then you could probably create an SSIS package to help you automate the process.

If you have a search for SQL Merge tools, or look at this question

A restore is replacing the database, its not running any kinda of insert or update transact sql it really is just overwriting the database.