1

I'm trying to restore a db to a new location, using the following in SQL Server Management Studio for Server2012:

RESTORE [newdb-name] FROM DISK = '..\backupfile.bak'
WITH MOVE 'olddb-name.mdf' to '...\newdb-name.mdf',
MOVE 'olddb-name_log.ldf' to '..\newdb-name_log.ldf';
GO

I'm getting the error "Incorrect syntax near 'newdb-name'" on line 1. Management studio isn't flagging it as a syntax error before running, and as the name has a hyphen I need to bracket it. Any help would be appreciated.

whybull
  • 13
  • 3

1 Answers1

0

You're missing the word DATABASE, as in RESTORE DATABASE.

Brent Ozar
  • 4,425
  • 18
  • 21