Restore with dynamic fields
jonstahura
Posts: 18
Hi.. I don't know if anyone has done this, but I have quite a few databases I would like to restore automatically. I have a vb.net program passing variables to a stored procedure and would like the sql backup 7 to use those in the restore command... something like below:
EXECUTE master..sqlbackup '-SQL "RESTORE DATABASE [@sitename + ''_APP_'' + @DBSUFFIX]
FROM DISK = @backupfilepath WITH MOVE DATAFILES TO @dbdirectory,
MOVE LOGFILES TO @tlogdirectory, REPLACE " '
EXECUTE master..sqlbackup '-SQL "RESTORE DATABASE [@sitename + ''_APP_'' + @DBSUFFIX]
FROM DISK = @backupfilepath WITH MOVE DATAFILES TO @dbdirectory,
MOVE LOGFILES TO @tlogdirectory, REPLACE " '
Comments
I needed more single quotes... a LOT more.... and then it worked!