Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trigger question
Message
De
22/01/2001 09:48:56
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00466553
Message ID:
00466577
Vues:
10
Larry -

thanks - that is (sort of) what I'm already doing - I was hoping for a simple function along the lines of "If TriggerEvent() = 'Insert'"

>>Hi,
>>
>>Is there any (quick easy) way to tell from within a trigger which event caused the trigger to fire? i.e. - if I have a trigger on update/insert - I would like to know whether it was an insert or an update that caused the trigger to hit
>>
>>TIA!
>
>declare ninsert int, ndelete int
>select ninsert = count(*) from inserted
>select ndelete = count(*) from deleted
>
>if ninsert > 0 /* insert trigger */
>if ndelete > 0 /* delete trigger */
>if ninsert > 0 and ndelete > 0 /* update trigger */
>
>HTH.
Ken B. Matson
GCom2 Solutions
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform