CREATE PROCEDURE myProc @id int
AS
BEGIN TRY
BEGIN TRANSACTION
DELETE employee WHERE ID = @ID
COMMIT TRANSACTION
END TRY
BEGIN CATCH
DECLARE @Err AS int
DECLARE @Msg AS varchar(max)
SET @Err = @@Error
SET @Msg = Error_Message()
ROLLBACK TRANSACTION
INSERT ErrorTable
VALUES (@err, @msg)
END CATCH
AS
BEGIN TRY
BEGIN TRANSACTION
DELETE employee WHERE ID = @ID
COMMIT TRANSACTION
END TRY
BEGIN CATCH
DECLARE @Err AS int
DECLARE @Msg AS varchar(max)
SET @Err = @@Error
SET @Msg = Error_Message()
ROLLBACK TRANSACTION
INSERT ErrorTable
VALUES (@err, @msg)
END CATCH
No comments:
Post a Comment