create TRIGGER [dbo].[TRI_DOLAR] ON [dbo].[SAACXC] 
FOR INSERT  
AS
IF @@ROWCOUNT = 0 RETURN 
DECLARE @TipoCxC  VARCHAR(1)
DECLARE @NumeroD  VARCHAR(20)
DECLARE @Nrounico int
DECLARE @monto AS FLOAT
DECLARE @saldo AS FLOAT
DECLARE @FACTOR AS FLOAT
DECLARE @FactorCxC AS FLOAT
SET DATEFORMAT YMD

select @Tipocxc=Tipocxc, @NumeroD=NumeroD, @Nrounico=Nrounico, @Monto=Monto, @Saldo=Saldo, @FactorCxC=Factor 
 from inserted;

select top 1 @FACTOR=factor FROM SACONF;

UPDATE SAACXC SET FACTOR=@FACTOR, NOTAS10='FACTOR ORIGINAL: ' + CAST(@FACTOR AS NVARCHAR) WHERE Nrounico=@NroUnico;
