I want to restore database in SQL Server 2008 R2 using a bak file and stored procedure of Lite speed. Below is my Code:
USE Master
Go
exec master.dbo.XP_RESTORE_DATABASE
@database="abc"
,@filename='M:\BACKUPS\xyz.bak'
,@WITH= 'REPLACE'
,@WITH= 'MOVE' "abc_DATA" TO "H:\SQLDATA\ABC.mdf"'
,@WITH= 'MOVE' "abc_LOG" TO "H:\SQLDATA\ABC.ldf"'
GO
After executing the above query I got below error:
Incorrect Syntax near 'abc_DATA'.
I don't know why I am getting this error as I always used this query to restore database.
'characters there. A quick hunt suggests that the'immediately afterMOVEshouldn't be there.xp_restore_databaseis not a SQL Server procedure. It's a part of the Litespeed product'MOVE'. That second'means onlyMOVEis part of the string. Remove it in both cases, ie write ,@WITH= 'MOVE "abc_DATA" TO "H:\SQLDATA\ABC.mdf"'