Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-04-20 : 07:52:01
|
| ravi writes "Hi,The following is my trigger:create trigger sampleon emp1for insert, delete, updateas beginprint ('sample trigger')endIs there any possibilty of finding the type of action(insert, update, delete) that has invoked the above trigger(sample) within the trigger. something similer to event handling.it's very important task, can any one help.Thanks in advance" |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2005-04-20 : 08:00:47
|
update(column_name) will tell you if the column has been updated,records are stored in:for insert = insertedfor update = deleted (old data) and inserted (new data)for delete = deletedusually, i check for the unique key if i'm differentiating insert from update, for delete, i compute the column values using columns_updated()check this two functions in BOLTo be simple: make separate triggers for insert, delete and update HTH--------------------keeping it simple... |
 |
|
|
|
|
|