CREATE TRIGGER [dbo].[TU_Price_Over_Under] ON [dbo].[Over_Under_Factor]
For  Update
AS 

Declare @Price  Money
Declare @Nu Bigint
Declare @Id Bigint

  If Update(Price)   
  begin
    Select @Nu=i.AutoId ,@Price=Round(i.Price,0) , @Id = i.Id_Havaleh
    from inserted i
    where AutoId=i.AutoId
    
    Update  sanad set Bedeh=@Price  Where (Nu_Over_Under=@Nu) and (Bestan=0) 
    Update  sanad set Bestan=@Price  Where (Nu_Over_Under=@Nu) and (Bedeh=0) 
  end



