Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 restore database

Author  Topic 

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2014-06-13 : 02:29:37
hi guys
I created a new database
and want to recover data from a backup
this script


use master
go
restore database new
from disk='D:\new.bak'
go



but get an error

Message 3141, Level 16, State 0, Line 1
The database to be restored was named 'ats342'. Reissue the statement using the WITH REPLACE option to overwrite the 'new' database.
Message 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

http://sql-az.tr.gg/

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-06-13 : 11:36:28
use master
go
restore database new
from disk='D:\new.bak'
with replace
go

You might need to add the MOVE option too.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -