0

Hi Guys

I want to crete the SQL Tigger.There is table called Fruits.In fruits table it contain ITEM_CODE,ITEM_NAME and PRICE.So there is application that used to insert the values into fruits table.
So I want once ITEM_Name or ITEM_CODE is update then sql trigger execute and It insert the update record into another table in different server.MY Problem is How I get last modified ITEM CODE or ITEM_NAME

Is there some way to find las modified ITEM CODE without adding new column to table.

Thanks
Tank50

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by adam_k
0

insert into table
values (blah,blah)
SELECT SCOPE_IDENTITY
will give you the new given identity
if the new id is four you will get four
and if its not an automaticly given identity then you know it already in the insert itself

0

This is an old thread, I'm guessing that OP found answer already.
Anyway the answer is that since we are talking about trigger then the OP can use DELETED and INSERTED to figure out the old and the new records when updating or INSERTED for new records when inserting and DELETED for the deleted ones when deleting.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.