Thursday, January 14, 2016

How to create a Stored Procedure with Try Catch and Transaction

CREATE PROCEDURE dbo.spname
AS
BEGIN
BEGIN TRANSACTION;

BEGIN TRY

/*
YOUR COMMAND
/*

END TRY

BEGIN CATCH

IF @@TRANCOUNT > 0
       ROLLBACK TRANSACTION;
END CATCH;

IF @@TRANCOUNT > 0
   COMMIT TRANSACTION;


END;

Cheers!
Uma

1 comment:

  1. Hi Uma,

    Since I have limited RAM(4/5 GB for Talend Sandbox), I can't run the latest Talend Sanbox, which requires min of 8GB.
    So Can you please share with me older version of Talend, which runs in 4/5GB RAM?

    ReplyDelete