Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Update trigger question
Message
De
04/09/2002 18:16:01
 
 
À
04/09/2002 18:04:28
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00696875
Message ID:
00696886
Vues:
9
>1) I swear that some time ago I've seen source code that 'builds' the code for an update trigger 'on the fly' in the middle tier. Can this be done in the middle-tier?

Yes. You could do it.

>
>2) If the answer would amazingly be yes, my next question...would the connection to the database need DBO-level access in order to create that update trigger code?

From the BOL:

CREATE TRIGGER permissions default to the table owner on which the trigger is defined, the sysadmin fixed server role, and members of the db_owner and db_ddladmin fixed database roles, and are not transferable.

>3) Also, if the answer is yes, obviously the trigger needs to have a name. Suppose two users are updating at the same time. If a trigger is being created 'twice' with the same name, would that cause a conflict?

Yes.

>(I realize that even if this is possible, the syntax for Oracle and SQL Server is somewhat different...I can account for that in code).

>I'm sure these are questions to laugh at, ...

Yes (sorry, couldn't help it.)

>We have application logging and other requirements when data is saved...doing so in triggers seems to be cleaner and faster than adding logic (and additional INSERT statements) in the middle-tier.

As long as you're going through the effort to write the batch that contains the code for the trigger, you might just as well issue the queries as you do the data modification and skip the triggers.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform