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 |
netwerkassist
Starting Member
13 Posts |
Posted - 2007-12-08 : 18:23:19
|
I'm new to triggers and looking for some help for this case.Basically whenever there is an update, delete, insert on table (PS_JOB) I need to populate a 2nd table (PS_IWAY_CTL) that has these columns: Table_Name, Primary_Key1, Primary_Key2, Primary_Key3, Action and Date-Time with this information: Table Name, 3 index keys from PS_JOB being key1 to Primary_Key1, key2 to Primary_Key2 and key3 to Primary_Key3 , Insert/Delete or Update into Action and finally enter current date time to Date-Time column. I believe I would start off with something like:CREATE TRIGGER PS_DEPT_TBL_TRG ON HR83PTST.PS_DEPT_TBL AFTER INSERT, UPDATE, DELETE AS INSERT PS_IWAY_CTL ([TABLENAME], [PRIMARY_KEY_1], [PRIMARY_KEY_2], [PRIMARY_KEY_3], [ACTION], [DATE]) Appreciate help |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-12-08 : 19:38:02
|
You can get involved rows from inserted and deleted tables. |
 |
|
|
|
|
|
|