Here's an alternative:
Note that the SOURCE and LATEST_FULL options must come immediately after the DISK value.
Code: |
DECLARE @exitcode int DECLARE @sqlerrorcode int DECLARE @sitename nvarchar(16) DECLARE @sql nvarchar(1024) SET @sitename = '<your value>' SET @sql = '-SQL "RESTORE DATABASE ' + @sitename + ' FROM DISK = ''D:\SQLVMDEV10\' + @sitename + '\FULL\*.sqb'' SOURCE = ''' + @sitename + ''' LATEST_FULL WITH MOVE DATAFILES TO ''G:\VirtualRestore'' , MOVE LOGFILES TO ''G:\VirtualRestore'' , MAILTO = ''ed.watson@swfwmd.state.fl.us'', RECOVERY, DISCONNECT_EXISTING, REPLACE , CHECKDB = ''ALL_ERRORMSGS, DATA_PURITY, EXTENDED_LOGICAL_CHECKS'', DROPDB' EXEC master..sqlbackup @sql, @exitcode OUT, @sqlerrorcode OUT |
Note that the SOURCE and LATEST_FULL options must come immediately after the DISK value.