give the concept of before and after trigger..

Recommended Answers

All 5 Replies

Member Avatar for hfx642

Before - Before table or record event
After - After table or record event
Why does that confuse you?

Before - Before table or record event
After - After table or record event
Why does that confuse you?

they confuse me becouse
when we insert any record into the table they
inserted while using before or after
in both the cases the record is insert into the table.
that's why i'm confuse. so,tell me when we use the "before trigger"
and when "after trigger"....

please explain what exactly you are doing.

I will explain the difference between the two.

Member Avatar for hfx642

Well... Yes.
The record is going into the database.
a) What do you want to happen just before the record is inserted.
This is usually used to populate; a primary key, an audit column, etc.
b) What do you want to happen just after the record is inserted.
This might be used to insert another record (related to this one) into another table.
Either way (unless there is an error), the record is going into the table.
You can also write before and after triggers on deletions and updates.
Those are the six common table triggers.
They can be written "For Each Row" or for a single transaction.

You need to go through this for details.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.