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-10-02 : 02:46:58
|
| create trigger tr_mytbl_ins on tbl1 for insertasupdate tbl2set fld1 = fld1 + i.fld2from tbl2 tjoin inserted ion tbl2.FK = i.PKgoi got this code from NR which, updates the value of a field(fld1) from table tb2 whenever record is inserted into tab1. and i'm a bit confuse. What does i.fld2, t, i means? |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-10-02 : 07:05:52
|
| These are table aliases. Look up "Using Table Aliases" in Books Online.Jay White{0} |
 |
|
|
james_yoder@hotmail.com
Starting Member
9 Posts |
Posted - 2003-10-02 : 09:52:25
|
| This statement is using aliases.Here is how it works...the linefrom tbl2 t - is saying tbl2 can be referenced as tjoin inserted i - is saying the inserted table (inserted) can be referenced as iStands to reason, then that i.fld2 really is referncing the fld2 column in the inserted table.FYI an inserted table is an automatically generated temp table that contains the new row that is being inserted into your table. This will go away after the insertion is completed.Hope this helps clear things up.James |
 |
|
|
|
|
|