Question

RESTORE DATABASE Umbraco6
FROM  DISK = 'C:\Temp\initial_db.bak'
    WITH  MOVE 'Umbraco6'     TO @db_physical_path  + '\test_data.mdf',
MOVE 'Umbraco6_log' TO  @db_physical_path + '\test_data.ldf',
REPLACE

In the above SQL script I get error:

'incorrect syntax error near '+'.

Any ideas?

Was it helpful?

Solution

declare @db_physical_path_data nvarchar(200)
declare @db_physical_path_log nvarchar(200)

set @db_physical_path_data = @db_physical_path + '\test_data.mdf'
set @db_physical_path_log = @db_physical_path +'\test_data.ldf'

RESTORE DATABASE Umbraco6
 FROM DISK = N'C:\Temp\initial_db.bak'
 WITH MOVE N'Umbraco6' TO @db_physical_path_data,
 MOVE N'Umbraco6_log' TO @db_physical_path_log, REPLACE
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top