Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Determining whether UPDATE or INSERT was called
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01467465
Message ID:
01467466
Vues:
38
Like I said earlier, the only way I know to check is something like this:


IF EXISTS (SELECT * FROM DELETED) -- a DELETE was done

IF EXISTS (SELECT * FROM INSERTED) -- an INSERT was done.


If your INSTEAD OF trigger is checking either for an INSERT or a DELETE, only one of the two conditions will be true, but not both.. (Obviously, in an UPDATE, both will be true, but I don't think you're asking about that one.


I'd be curious if there's another way - though not sure it would be any less lines of code than above.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform