Hi All. while taking log backup of a database before taking full backup I am getting the below errors : Msg 4214, Level 16, State 1, Line 4 BACKUP LOG cannot be performed because there is no current database backup. Msg 3013, Level 16, State 1, Line 4 BACKUP LOG is terminating abnormally. But while using Try Catch method I am unable to catch 4214 error:
Using Powershell ISE I am able to do it.
Could somebody please help me in writing a stored procedure to catch the 4214 error too.
Answer by ThomasRushton ·
TRY..CATCH only picks up the last error.
If you're using SQL2012 or later, you could use THROW within the CATCH statement. This will return all the errors, but it'll also abort processing, so you might not be able to do anything useful within the scope of the same script...
Erland Sommarskog has, in one of his epic essays, some other thoughts. Check it out - http://www.sommarskog.se/error_handling/Part3.html#AdminCommands