I'm using Tsql script to restore several databases.
RESTORE DATABASE XXX_M
FROM DISK = 'C:\XXX.bak'
WITH FILE = 1, replace
GO
Sometimes the .bak file comes corrupted (not data corrupted ).
I want to know if there is a way to check if the file is not corrupted then restore else don't. I've tried to use @@rowcount after restore VERIFYONLY but it's not good.
RESTORE VERIFYONLY
FROM DISK = 'C:\xxx.bak'
if @@ROWCOUNT !=0
print 'false'
else
print 'good'
Any other ideas?
Thanks.