"How can I check after an Update or Insert if an error occurs"You might want to check @@ROWCOUNT too - if you are only expecting one row to be updated and all the rows in the table get updated that's probably an error too!DECLARE @intErrNo int, @intRowCount intBEGIN TRANSACTIONUPDATE USET MyCol = 'FOO'FROM MyTable AS U JOIN MyOtherTable AS O ON O.MyPK = U.MyPKSELECT @intErrNo = @@ERROR, @intRowCount = @@ROWCOUNTIF @intErrNo = 0 AND @intRowCount = 1BEGIN COMMITENDELSEBEING ROLLBACK PRINT 'Error Occurred'END
Kristen