Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Trigger Question

Status
Not open for further replies.

nerdalert1

Programmer
Nov 4, 2004
92
US
Hello all. When Selecting from the Inserted table on a trigger wont there always be just one record?

UPDATE Customer Set MailSend = 1 where CustNumb =
(SELECT CustNumb FROM INSERTED)

This is on the insert of a new record. Wont I only have one value for this each time? Somehow I am hearing this is updating multiple records.
 
The inserted table contains multiple records if multiple records are inserted. Therefore you should always write your triggers to account for this. Your code would indeed update multiple records if multiple were inserted, it would also update multiple records if custnumb is not a unique field in this table.

Questions about posting. See faq183-874
Click here to learn Ways to help with Tsunami Relief
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top