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 |
|
PatDeV
Posting Yak Master
197 Posts |
Posted - 2006-07-06 : 11:35:00
|
| Hi all is this code right for insert and update trigger please check?Thankscreate trigger [dbo].Emailinsertupdate on [dbo].EmailFOR INSERT,updateASif not EXISTS (SELECT c.emailaddress FROM emailtest c join inserted i on c.emailaddress = i.emailaddress)begininsert into Emailtest (emailaddress)select emailaddress from insertedend else if EXISTS (SELECT c.emailaddress FROM emailtest c join inserted i on c.emailaddress = i.emailaddress)beginupdate cset c.emailaddress = i.emailaddressFROM emailtest c join inserted i on c.emailaddress = i.emailaddressend |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-07-06 : 12:55:53
|
| Well what is it supposed to do?Tara Kizeraka tduggan |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-07-06 : 13:12:07
|
| I see what the trigger is doing too, but I'm wondering what it is supposed to do. Without an explanation as to what it is supposed to do, it's hard to say if it is correct.I agree that this is unnecessary overhead.Tara Kizeraka tduggan |
 |
|
|
|
|
|