IF @IsTransactionRequired = 1
BEGIN
	BEGIN TRANSACTION
END

BEGIN TRY
IF EXISTS(SELECT * FROM [LegitimateKZN_NEO].[DBO].[AssociationMemberData] WHERE AssociationMemberDataID = @AssociationMemberDataID)
BEGIN
	UPDATE [LegitimateKZN_NEO].[dbo].[AssociationMemberData]
	   SET [ModifiedDate] = GETDATE()
		   ,[IsCancelled] = 1
	 WHERE AssociationMemberDataID = @AssociationMemberDataID
END

	SELECT 1 AS Success

	IF(@IsTransactionRequired = 1)
	BEGIN
		COMMIT TRANSACTION 
	END
END TRY
BEGIN CATCH
  
	IF XACT_STATE() <> 0 AND @IsTransactionRequired = 1
    BEGIN
        ROLLBACK TRANSACTION;
    END
    
    SELECT 0 AS Success
END CATCH