Skip to content
Advertisement

Cannot catch SQL Server alter table error

It is a really simple code, but it cannot catch the error.

Or how to catch the error?

Thanks.

Advertisement

Answer

Errors that occur as a result of batch recompilation after deferred name resolution cannot be caught at the same level the error occurs. One work-around is to wrap the DDL in dynamic SQL:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement