restore headeronly failure stops stored procedure

  • Hi all,

    I have a proc that performs a "restore headeronly" on a list of backup files. I don't want the proc to fail if it can't find a file before it reaches the end of the list. If it does encounter an error, the proc fails at that point and doesn't continue - this is not what I need it to do.

    I've tried creating a separate stored procedure that performs the restore headeronly using return (where the calling proc stores the return value but doesn't do anything with it). The failure still stops the calling proc. an "if @@error<>0 begin RAISERROR('warning',10,1)"... doesn't do the trick, either.

    Anyone have any ideas? Thanks in advance...

  • Have you tried using a Try Catch block to handle it?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • I haven't, only b/c this proc needs to run in 2k and 2k5 instances...

    I will test it for curiosity's sake, but I will eventually need a solution that can run in both...

  • If it needs to run on 2k, I'd seriously look at moving it out of the database into a service or app. You'll get all the error handling you could possibly want if it's being run by a .NET loop outside the database.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply