Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create a SQL2K trigger that updates other fields?
Message
De
21/10/2002 18:05:02
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00713079
Message ID:
00713691
Vues:
18
Thanks for the idea, I'll try it and tell you.

TIA.


>Here's sample trigger that updates 'fld_dt' field with the current datetime for any updated records.
CREATE TRIGGER mytrigger
>ON mytable
>FOR UPDATE
>AS
>BEGIN
>  -- Don't update if it's recursive call from the same trigger
>  IF NOT UPDATE(fld_dt)
>	UPDATE mytable
>		SET fld_dt = getdate()
>		FROM mytable
>		INNER JOIN deleted ON mytable.pkfld = deleted.pkfld
>END
>
>>Sergey, the examples don't give me any idea on how to do it, they just explain how to update other tables but in a batch way. I can´t know what record has changed, it only give me examples on knowing columns states, so would it be difficult to do it? I would do it in a VFP store procedure but those don't allow me to update the same table that the trigger belongs to.
>>
>>Thanks, I hope you or somebody else can help me with this.
>>
>>Luis
>>
>>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform