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.


insert into table
values (blah,blah)
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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.