Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sanjay1909
Starting Member
14 Posts |
Posted - 2004-09-30 : 01:49:44
|
| Hi all,The below Stored procedure gives be error on execution and does not handle. I am trying to insert a duplicate record in mytable which should generate a system constraint error. On error it should insert in ErrorTable. But it halts on error. Please give some JaanLeva solution.CREATE PROCEDURE [dbo].[san] ASBEGIN INSERT INTO mytable (column1) VALUES ('sanjay') IF (@@ERROR <> 0) BEGIN SELECT @ErrFlag = 1 SELECT @CommitFlag = 1 SELECT @ErrNo = @@ERROR SELECT @ErrMsg = 'Duplicate Rec - ' & @RecNo INSERT INTO ERRORTABLE (ERRS_ErrorNo, ERRS_ErrorDesc) VALUES (@@ERROR, 'DUPLICATE RECORD EXISTS') ENDENDGORegardsSanjay Masawansanjaymasawan@yahoo.comRegardsSanjay Masawansanjaymasawan@yahoo.com |
|
|
|
|
|