- Example statement
CREATE TABLE #Temp (ID Int Id Intity (1, 1), Value Int
Go
Begin TRAN
INSERT INTO #TEMP (Value) VALUES (100)
INSERT INTO #TEMP (Value) VALUES (Convert (int, 'abc'))
- Settings of Set XACT_ABORT Unable to handle this error
Commit TRAN
Go
- If there is no such sentence, SQL executes it here for an exception, and the following handles @@ error's statement will not occur.
IF (@@ Error <> 0)
Print 'Error'
Another: The SET XACT_ABORT method can handle the situation similar to foreign key errors, and cannot process the error similar to the above labeled, details refer to the instructions for the SQL Server online documentation.