hey guys. i am trying to get a simple trigger to work.
if i update a field then it sets the corresponding fields with a date.
but the code below when u update the field it then updates ALL fields in table 
with said date.

i am sure i just need to pass the pkey as a @var to a where clause.
but i am not sure how.



CREATE TRIGGER trig_Update_Waive_Date

ON customer
FOR UPDATE 
AS

IF UPDATE(waive)
BEGIN
    IF @@ROWCOUNT = 0
                                UPDATE customer
                                SET waive_date = getdate()
                ELSE
                                ROLLBACK TRANSACTION
END 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335374
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to