|  | Posted by John Bell on 06/19/05 17:19 
Hi
 This is almost exactly the same as the example in the link I posted,
 although what is not clear is what your key is for the tables. If this is
 PRECO and that is your only way of uniquely identifying a record, then you
 may want to think creating an alternate key that will not change.
 
 John
 
 
 "Lucio Chiessi [VORio]" <lucio@vorio.eti.br> wrote in message
 news:1119183680.118011.231620@g14g2000cwa.googlegroups.com...
 > hI John.  Thanks a lot for your reply!
 >
 > I'm posting now my code.  If you can help me, thanks a lot twice!
 >
 > =================================================================
 >
 > CREATE TRIGGER [Reg_Chg_Preco] ON [dbo].[PRECOS_ESPECIAIS]
 > FOR UPDATE
 > AS
 > Declare @cProdNo as char(10)
 > Declare @cFrClNo as char(10)
 > Declare @lIsCompra as bit
 > Declare @nPrecAnt as numeric(15,5)
 > Declare @nPrecNov as numeric(15,5)
 >
 > IF Update(PRECO)
 > Begin
 > Select  @nPrecAnt = del.PRECO from deleted as del
 > Select @cProdNo = ins.PRODNO, @cFrClNo = ins.FRCLNO,@nPrecNov =
 > ins.PRECO, @lIsCompra = ins.ISCOMPRA from inserted as ins
 > Insert into HIST_CHG_PRECO values
 > (GetDate(),@cProdNo,@cFrClNo,@lIsCompra,@nPrecAnt,@nPrecNov)
 > End
 > GO
 >
 > ==================================================================
 >
 > John Bell escreveu:
 >> Hi
 >>
 >> You didn't post your code to it is hard to comment. Triggers need to
 >> cater
 >> for multiple rows being effected by the statement that triggers them.
 >
  Navigation: [Reply to this message] |