How do I restore my SQL .bak file over the existing database? Do I need to delete what is there already? On a new Windows installation I need to restore our production SQL database from a .bak file. What steps do I need to take? Can I overwrite data or do I need to restore to a fresh database?
Software/Hardware used:
SQL
ASKED:
July 13, 2010 5:31 PM
UPDATED:
July 14, 2010 10:31 PM
You can add the “replace” in the sql like this:
RESTORE DATABASE
FROM DISK = N’D:SQLDataAdventureWorks.bak’
WITH
FILE = 4,
MOVE N’AdventureWorks_Data’
TO N’D:SQLDataDBDataAdventureWorks.mdf’,
MOVE N’AdventureWorks_Log’
TO N’D:SQLDataDBLogAdventureWorks.ldf’,
NOUNLOAD,
REPLACE,
STATS = 10
GO