Hi Team,
I am working on dynamically restore DB.
As part of this i have created store procedure.
While running getting below syntax error:
Msg 102, Level 15, State 1, Line 12
Incorrect syntax near 'dba_db'.
Msg 132, Level 15, State 1, Line 13
The label 'L' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 132, Level 15, State 1, Line 14
The label 'L' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 132, Level 15, State 1, Line 15
The label 'L' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 132, Level 15, State 1, Line 16
The label 'L' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 132, Level 15, State 1, Line 17
The label 'L' has already been declared. Label names must be unique within a query batch or stored procedure.
Msg 132, Level 15, State 1, Line 18
DECLARE @backup_files varchar(8000)
exec ABC.dbo.pr_RESTORE_STRING_FOLDER '\\1.2.3.4\dba\FULL\', 'dba_db', @backup_files OUTPUT
DECLARE @SQL VARCHAR(8000);
SET @SQL = @backup_files + CHAR(10) + 'WITH
MOVE 'dba_db' TO 'L:\DATA\CAERPT1D\dba_db_NEW\dba_db.mdf' ,
MOVE 'dba_db_log' TO 'L:\LOG\CAERPT1D\dba_db_NEW\dba_db_log.ldf' ,
MOVE 'dba_db_FG_IX' TO 'L:\DATA\CAERPT1D\dba_db_NEW\dba_db_FG_IX.ndf' ,
MOVE 'dba_db_FG_PK_DEF' TO 'L:\DATA\CAERPT1D\dba_db_NEW\dba_db_FG_PK_DEF.ndf' ,
MOVE 'dba_db_FG_PK1_worlf' TO 'L:\DATA\CAERPT1D\dba_db_NEW\dba_db_FG_PK1_worlf.ndf'