I'm trying to do something really simple, but with one problem:
declare @cmd varchar(1000)
set @cmd='restore verifyonly from disk =''\\server\backup_folder\''?'''
exec sp_msforeachdb @cmd
Obviously its not working. I need the name of the backup file to run Verifyonly
( in the above code, i'm taking the Database name ).
Is there a way to automate Verifyonly
, to run in all backup files?
How can I use the name of the backup file that has been made, in my code?
Thank you very much.
( People are saying MsForeachdb
is not safe. I will try to search another option, like Foreachdb
)
SQL SERVER 2008
EDIT1: Well, As i see here, I don't think verifyonly
is a good idea, but will be good to know how to do it ( only for knowledge )