954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Find last modofied Item cocde

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

Tank50
Junior Poster
124 posts since Aug 2008
Reputation Points: 12
Solved Threads: 1
 

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

noamwegner
Newbie Poster
12 posts since Apr 2010
Reputation Points: 10
Solved Threads: 1
 

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.

adam_k
Practically a Posting Shark
803 posts since Jun 2011
Reputation Points: 256
Solved Threads: 149
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You