Explanation of TRY…CATCH and ERROR Handling

giovedì 08 settembre 2011 - 14.40

gsflash80 Profilo | Junior Member


If I try to drop a constraint which does not exist in the database by using the below command I get the error message

Msg 3728, Level 16, State 1, Line 1
‘FK_ReferencedWorkspace_SchemaVersion1′ is not a constraint.
Msg 3727, Level 16, State 0, Line 1
Could not drop constraint. See previous errors.

However if I have the same code enclosed within a try .. catch block with the statement

select ERROR_NUMBER() as ErrorNumber,
ERROR_LINE() AS ErrorLine,
ERROR_MESSAGE() as ErrorMessage

it only returns me the second error as

“Could not drop constraint. See previous errors.”

How do I get the full error message so that I can trobleshoot easily OR is this a limitation of SQL Server 2005?


..:: GSFLASH ::..
Ubuntu 11.04/OpenSuse 10.3
Vista Seven/MacOSX SnowLeopard
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2018
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5