I want to automate the restore of a database from the latest backup file in a directory with multiple backup files. I can determine the name of this file from msdb but I need to pass the name of the file to the restore command as a variable. The following syntax works with MSSQL restore but not SQL Backup restore:
restore database TEST from disk = @BackupFileName ....
OK
EXEC master..sqlbackup N'-SQL "RESTORE DATABASE [TEST] FROM DISK = @BackupFileName ....
SQL Backup v4.5.704
Syntax error: '@BackupFileName' after '='
Thanks.
restore database TEST from disk = @BackupFileName ....
OK
EXEC master..sqlbackup N'-SQL "RESTORE DATABASE [TEST] FROM DISK = @BackupFileName ....
SQL Backup v4.5.704
Syntax error: '@BackupFileName' after '='
Thanks.