Hi, I'm new to SQL Server 2005 and I have a question regrading triggering.
I have a table A with fields: A_Message, B_ID
And table B with fields: B_ID, B_Message
and table C with fields: A_Message, B_Message
And I want that every time that a record is inserted to table A, then a new row will be inserted to table C.
Here is what I wrote:
Alter trigger dbo.trigger_temp
INSERT TableC VALUES(?????)
I don't know how to tell the trigger from where to take the data, how to retrieve it from the new row. Can you help me?
Thanks a lot:
Unfortunately some of the code snippets in those links are very bad examples. The one called "Purchasing.LowCredit" for example will fail to work correctly if more than one row is updated. Never be tempted to write a trigger like that.
To be fair, it isn't strictly correct to say it won't work correctly if 2+ rows are inserted. Sometimes it will work correctly, sometimes it will not. Although you might quibble with what "working correctly" would actually be.