0

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
  • What is the source of the backup? Is the backup from this server or another server? Commented Apr 5, 2019 at 12:45

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.