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 |
|
Mazdak
Yak Posting Veteran
63 Posts |
Posted - 2002-12-03 : 04:05:22
|
| When I use trigger for insert and delete I can use INSERTED and DELETED keywords but there is nothing for UPDATE,so in the triggers for update,how can I access to the updated row. |
|
|
rihardh
Constraint Violating Yak Guru
307 Posts |
Posted - 2002-12-03 : 04:13:40
|
| I think you are referring to the inserted and deleted system temporary tables. A brief description:- if delete occurs - look for records in deleted- if insert occurs - look for records in inserted- if update occurs - look in boththe rest of it is described in BOL... |
 |
|
|
Mazdak
Yak Posting Veteran
63 Posts |
Posted - 2002-12-03 : 07:11:35
|
quote: I think you are referring to the inserted and deleted system temporary tables. A brief description:- if delete occurs - look for records in deleted- if insert occurs - look for records in inserted- if update occurs - look in boththe rest of it is described in BOL...
Sorry I can't get it.I can use deleted and inserted in trigger but I can't use updated,so what can I use? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-12-03 : 07:14:10
|
| There is no updated pseudo table. When performing an UPDATE, both deleted and inserted are available for the trigger. They contain the before and after values of the rows affected by the UPDATE.If you read the entries in Books Online for "triggers", "update triggers", and "CREATE TRIGGER" there are examples of how to use them in an UPDATE trigger. |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2002-12-03 : 07:15:06
|
| You use inserted and deleted. "updated" as a concept simply deletes what was there and inserts what is to be there now. Hence the "old" record will be in deleted and the "updated" record will be in inserted. I think.-------Moo. |
 |
|
|
Mazdak
Yak Posting Veteran
63 Posts |
Posted - 2002-12-04 : 02:32:36
|
Thank you both.I got it. |
 |
|
|
|
|
|