Issue:
When Two user tring to insert at same time at same place, then two row are generating for the same row as given below :
What happening is here, both records came at same time, when first record finish the execute INSERT query and came out then second also come inside the INSERT because when its in there till then first one was not in database so, it understand that its a new record and new row generated.
- INSERT INTO MME.ForecastAdjustmentLineItem
- (ForecastVersionId
- ,[CostCollectorId]
- ,AdjustmentDesc
- ,AdjustmentTypeCd
- ,ElementCategoryId
- ,CurrencyCd
- ,AdjustmentAmt
- ,SpeculativeInd
- ,CreateUserId
- ,CreateDttm
- ,UpdateUserId
- ,UpdateDttm
- ,LastUpdateDttm)
- VALUES
- (@ForecastVersionId
- ,@CostCollectorId
- ,@AdjustmentDesc
- ,@AdjustmentTypeCd
- ,@ElementCategoryId
- ,@CurrencyCd
- ,@AdjustmentAmt
- ,0
- ,@CreateUserId
- ,@CreateDttm
- ,@UpdateUserId
- ,@UpdateDttm
- ,@LastUpdateDttm )
- SET @ForecastAdjustmentLineItemId = SCOPE_IDENTITY()