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 - 2003-08-22 : 07:53:03
|
| ruchi writes "I have 3 tables table1 (divisionId int primary key, descript varchar(50))table2(divisionId int , division_leagueId int)table3(division_leagueId int, descript varchar(50))I want to write a trigger that reflect change in table3 when we update descript in table1.What i'm doing is Create Trigger abcon table1 For UpdateIf update(descript)Begindeclare @divisionId int,@descript varchar(50) select @divisionId = divisionId from deleted select @descript = descript from insertedupdate table3set descript = @descript where division_leagueId in( select division_leagueId from table2 where) divisionId = @divisionId )endIt gives me identity column error but if i store @divisionId in temp table then it works fine.Please suggest.Thanks" |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-08-22 : 08:08:42
|
This must be the "de-normalization for performance" concept I've heard so much about.update t3set descript = i.descriptfrom table3 t3 inner join table2 t2 on t3.division_leagueid = t2.division_leagueid inner join inserted i on t2.division_id = i.division_id inner join deleted d on i.descript <> d.descript Jay White{0} |
 |
|
|
|
|
|