Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update trigger - why it works?
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01291246
Message ID:
01291519
Vues:
7
>Thanks for the UPDATE(column) function which I didn't know. But the question still remains - is it OK or not to UPDATE another column in the UPDATE trigger.
>
>May be there is a way to find out current RECURSIVE_TRIGGERS option status and adjust it inside the trigger's code and restore back?

ALTER DATABASE ... before and after trigger? Grrr, I don't think so.
Also I am not sure that ALTER DATABASE will works if you have connection to that Database, I am pretty sure that this command requires exclusive use of the database (you should check this, I am not sure about it).
It is OK (for me) to change the same table with the trigger. Just use that check. Remember TRIGGER fires once after the job is done not after each record you changed.
If the RECURIVE_TRIGGERS is ON first time the trigger is fired you will have Status field updated so you do UPDATE of the second field, the second time trigger is fired that field would be not updated and the trigger stop fired itself.
AGAIN NOT TESTED :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform