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 [AssociationID] = @AssociationID 		  ,[Association Name] = @Association_Name 		  ,[Surname Or Company Name] = @Surname_Or_Company_Name 		  ,[Member First Name] = @Member_First_Name 		  ,[Member ID Number] = @Member_ID_Number 		  ,[ID Type] = @ID_Type 		  ,[Postal Address] = @Postal_Address 		  ,[Postal Address Code] = @Postal_Address_Code 		  ,[Physical Address] = @Physical_Address 		  ,[Tax Number] = @Tax_Number 		  ,[Tel  Number] = @Tel_Number 		  ,[Fax Number] = @Fax_Number 		  ,[Cell Number] = @Cell_Number 		  ,[Email Address] = @Email_Address 		  ,[OL Permit Number] = @OL_Permit_Number 		  ,[Vehicle Chassis Number] = @Vehicle_Chassis_Number 		  ,[vehicle registration] = @Vehicle_Registration 		  ,[LegitimateApplicationRequestDetailID] = @LegitimateApplicationRequestDetailID 		  ,[ModifiedDate] = GETDATE() 	 WHERE AssociationMemberDataID = @AssociationMemberDataID END ELSE BEGIN 	 IF(@AssociationMemberDataID = -1) 	 BEGIN 		INSERT INTO [LegitimateKZN_NEO].[dbo].[AssociationMemberData]            ([AssociationID],[Association Name],[Surname Or Company Name],[Member First Name],[Member ID Number],[ID Type],[Postal Address],[Postal Address Code],[Physical Address],[Tax Number],[Tel  Number],[Fax Number],[Cell Number],[Email Address],[OL Permit Number],[Vehicle Chassis Number],[vehicle registration],[LegitimateApplicationRequestDetailID],[AddedDate],[ModifiedDate], [IsCancelled]) 		VALUES 		   (@AssociationID, @Association_Name, @Surname_Or_Company_Name, @Member_First_Name, @Member_ID_Number, @ID_Type, @Postal_Address, @Postal_Address_Code, @Physical_Address, @Tax_Number, @Tel_Number, @Fax_Number, @Cell_Number, @Email_Address, @OL_Permit_Number, @Vehicle_Chassis_Number, @Vehicle_Registration, @LegitimateApplicationRequestDetailID, GETDATE(), GETDATE(), 0) 	 END 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