USE [AIADatabaseV5] GO /****** Object: StoredProcedure [dbo].[EC_UpdateUser] Script Date: 02/06/2018 10:49:32 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- =================================================================== -- Author: Magic -- Create date: 27-May-2009 -- Description: To update record into AIAUser,License and LicenseSubscriptionDetail table -- =================================================================== CREATE PROCEDURE [dbo].[EC_UpdateUser] -- Add the parameters for the stored procedure here @sLoginID varchar(50), @sAmountPaid money, @sAmountPending money AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. --SET NOCOUNT ON; DECLARE @iLicenseId varchar(20) SET @iLicenseId = (SELECT DISTINCT License.Id FROM AIAUser INNER JOIN AIAUserToLicenseEdition ON AIAUser.Id = AIAUserToLicenseEdition.UserId INNER JOIN LicenseToEdition ON AIAUserToLicenseEdition.LicenseEditionId = LicenseToEdition.Id INNER JOIN License ON LicenseToEdition.LicenseId = License.Id WHERE AIAUser.LoginId = @sLoginID) -- Update the LicenseSubscriptionDetail table for the supplied LoginID UPDATE LicenseSubscriptionDetail SET AmountPaid = @sAmountPaid, AmountPending = @sAmountPending WHERE LicenseId = @iLicenseId --Update the License status to Active for the LoginID UPDATE License SET IsActive = 1 WHERE Id = @iLicenseId --Update the AIAUser status to Active for the LooginID UPDATE AIAUser SET IsActive = 1 WHERE LoginId = @sLoginID END GO