I have 4000 lines of DML statements. Right now, each chunk of dml statement have comments along with FR. On PROD day if some error comes in middle of DML statement, some times it is becoming a challenge for us to identify. We can go to that error by doube clicking on error but not sure before or after dml statements executing properly or not. So how to overcome this?
We also discussed oneway to overcome this is to have something like this...Is below linkes are OK, is these there as per standards? I need your suggestions, please.
--FR 100
--Developer --John
BEGIN
BEGIN TRY
BEGIN TRANSACTION;
UPDATE my_sales
SET sales = sales + 1
WHERE itemid = 1;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
PRINT 'Error mumber: ' + CONVERT(varchar,ERROR_NUMBER())+
' on line: ' + CONVERT(varchar, ERROR_LINE())
ROLLBACK TRANSACTION;
END CATCH;
END;
GO