CREATE TABLE test1( fid VARCHAR(2) NULL )BEGIN TRY BEGIN TRANINSERT INTO test1(fid) VALUES('1')INSERT INTO test1(fid) VALUES('222')INSERT INTO test1(fid) VALUES('3')COMMIT TRANSACTIONEND TRYBEGIN CATCHIF @@TRANCOUNT>0 ROLLBACK TRANSACTION /* SELECT ERROR_NUMBER() AS ErrorNumber, ERROR_SEVERITY() AS ErrorSeverity, ERROR_STATE() AS ErrorState, ERROR_PROCEDURE() AS ErrorProcedure, ERROR_LINE() AS ErrorLine, ERROR_MESSAGE() AS ErrorMessage */END CATCH