January 12, 2010 at 3:17 pm
I just accomplished my first trigger! No problem getting it to work, however I do seem to get an error every time I try to make a change to the table from within my software that accesses the database. Here is the trigger:
CREATE TRIGGER UpdatePreqBrand_trigger ON PO_PREQ_LIN
AFTER INSERT
AS
BEGIN
update PO_PREQ_LIN
set PO_PREQ_LIN.COMMNT_1 = IM_ITEM.ADDL_DESCR_2
from PO_PREQ_LIN, IM_ITEM
where PO_PREQ_LIN.ITEM_NO = IM_ITEM.ITEM_NO and PREQ_NO IN (SELECT PREQ_NO FROM INSERTED);
END;
And the error I get when I try to make any changes (e.g. deleting an item):
Row cannot be located for updating. Some values may have been changed since it was last read
[Insert]
[SELECT * FROM [PO_PREQ_LIN] WHERE (1=0) ]
January 13, 2010 at 8:26 am
Can you post the table structures and some sample data so we can test against your schema?
Is there anything else going on in the transaction?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply