SQLTeam.com | Weblogs | Forums

Restore database


#1

Hi,

I am trying to restore the database as shown below;

RESTORE DATABASE MarBtch4a
FROM DISK = 'I:\DataMar16\Batch 4a\PseudoAnonymised_OTS_CDB_26480_-_Clinical_Practice_Research_Datalink_CPRD_-_LD8034_20160405.bak’ 
WITH 
MOVE 'PseudoAnonymised_OTS_CDB_26480_-_Clinical_Practice_Research_Datalink_CPRD_-_LD8034_20160405' 
TO 'I:\MarBtch4a.mdf',
MOVE 'PseudoAnonymised_OTS_CDB_26480_-_Clinical_Practice_Research_Datalink_CPRD_-_LD8034_20160405_log' 
TO 'I:\MarBtch4a_log.ldf'
GO

I receive the errors;

Msg 102, Level 15, State 1, Line 4
Incorrect syntax near 'PseudoAnonymised_OTS_CDB_26480_'.
Msg 132, Level 15, State 1, Line 7
The label 'I' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 105, Level 15, State 1, Line 7
Unclosed quotation mark after the character string '
GO
'.

Please help..

Thanks


#2

Take a look at this piece of text
_LD8034_20160405.bak’

Your final character , I belive , is not '


#3

Thank you so much - All errors disappeared, but I receive the error message;

Msg 3154, Level 16, State 4, Line 1
The backup set holds a backup of a database other than the existing 'MarBtch4a' database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Any help


#4

Add WITH REPLACE


#5

Fantastic - Its working now..

Thanks stepson


#6

Welcome!