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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 error in my code

Author  Topic 

joanne
Starting Member

46 Posts

Posted - 2005-11-13 : 09:37:26
i need your help, please!

I have this code:

DECLARE @DBName SYSNAME
DECLARE @filename VARCHAR(200)
declare @path varchar (100)
set @path='E:\SQL_DATA_DUMP\'
set @DBName = 'DBMMI'
-- Build the .BKP path and file name
SELECT @filename = @path + @DBName + '\' + @DBName + '_full' + '.BKP'
--restore database
restore database @DBName
from disk = @filename
with
MOVE DBMMI_Data to 'e:\sqldata\MSSQL\data\DBMMI_Data.MDF',
MOVE DBMMI_Log to 'e:\sqldata\MSSQL\data\DBMMI_Log.LDF',
STANDBY =@path + @DBName + '\' + @DBName + '_undo.dat'


and this is the error when the code runs:

Server: Msg 170, Level 15, State 1, Line 16
Line 16: Incorrect syntax near 'DBMMI_Data'.


thanks a lot for your help!

nr
SQLTeam MVY

12543 Posts

Posted - 2005-11-13 : 10:12:23
MOVE 'DBMMI_Data' to
see
http://www.nigelrivett.net/SQLAdmin/s_RestoreDatabase.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

joanne
Starting Member

46 Posts

Posted - 2005-11-13 : 10:50:24
Hi nr,

Many thanks for the link (it’s that I need now) and for ......quotes.
Go to Top of Page
   

- Advertisement -