Begin try
{SQL _statement | statement_block}
End try
Begin catch
[{SQL _statement | statement_block}]
End catch
[;]
----------------------------------------------------
Retrieve error messages
Within the scope of the catch block, you can use the following system functions to obtain the error message that causes the Catch Block to be executed:
Error_number () returns the error number.
Error_severity () returns the severity.
Error_state () returns the error Status Number.
Error_procedure () returns the name of the stored procedure or trigger with an error.
Error_line () returns the row number in the routine that causes the error.
Error_message () returns the complete text of the error message. This text can include any value provided by replaceable parameters, such as length, object name, or time.
-----------------------------------------------------------
Begin try
Begin transaction
----------------------------//////////////////////////////
Commit transaction
End try
Begin catch
Rollback
Declare @ errmsg nvarchar (4000), @ errseverity int
Select @ errmsg = error_message (), @ errseverity = error_severity ()
Raiserror (@ errmsg, @ errseverity, 1)
End catch
Run the transportation Forum, run the transportation, and revitalize the economy !!! (What are you waiting !!! Hurry up and click here !!!) The webmaster's blog about transportation, transportation, and economic success !!! (What are you waiting !!! Hurry up and click here !!!)