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 |
|
cristuballa
Starting Member
13 Posts |
Posted - 2003-09-21 : 23:23:08
|
i'm just new to sql trigger, and i have no idea on how to add/minus a numeric field value on a certain table whenever i insert record on other table. can show me how or refer me to existing tutorials. thanx in advance |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-09-22 : 00:02:56
|
| Seehttp://www.nigelrivett.net/Triggers_1_A_beginners_guide.htmlSomething likecreate trigger tr_mytbl_ins on tbl1 for insertasupdate tbl2set fld1 = fld1 + i.fld2from tbl2 tjoin inserted ion tbl2.FK = i.PKgo==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
cristuballa
Starting Member
13 Posts |
Posted - 2003-09-22 : 03:28:33
|
| thanx NR |
 |
|
|
cristuballa
Starting Member
13 Posts |
Posted - 2003-09-22 : 03:41:34
|
| does inserted function captures the latest inserted record? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-09-22 : 07:37:07
|
| inserted is not a function, it is a (pseudo) table that contains ALL of the rows affected by the last INSERT or UPDATE operation. |
 |
|
|
|
|
|