

BACKUP DATABASE [#JobManagerV2_WorkInst#] TO  DISK = N'#DBBackupDir#\#JobManagerV2_WorkInst#.DBBackup' WITH  COPY_ONLY,  RETAINDAYS = 1, NOFORMAT, INIT,  NAME = N'#JobManagerV2_WorkInst#-Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10, CONTINUE_AFTER_ERROR
GO
declare @backupSetId as int
select @backupSetId = position from msdb..backupset where database_name=N'#JobManagerV2_WorkInst#' and backup_set_id=(select max(backup_set_id) from msdb..backupset where database_name=N'#JobManagerV2_WorkInst#' )
if @backupSetId is null begin raiserror(N'Verify failed. Backup information for database ''#JobManagerV2_WorkInst#'' not found.', 16, 1) end
RESTORE VERIFYONLY FROM  DISK = N'#DBBackupDir#\#JobManagerV2_WorkInst#.DBBackup' WITH  FILE = @backupSetId,  NOUNLOAD,  NOREWIND
GO
