|
-
May 27th, 2008, 06:10 AM
#1
Thread Starter
Lively Member
[RESOLVED] Triggers and Identity Values
Hi all
I'm currently trying to write a trigger which will see when a field in a particular table has been updated and will create a new record in a completely separate table. So far I've set it up so that when the trigger executes, if the desired field has been updated, it will fire a stored procedure which will do everything else that I need it to do.
Everything's going fine in terms of writing the trigger and the procedure. However, I want to set the trigger up so that when it executes the stored procedure, that procedure only affects the record where the desired column was updated. How do I get SQL to identify the identity value of the record that caused the trigger to be fired? I did think of using @@Identity but that will only give me the identity value of the LAST record created, as opposed to the identity value of the last record where that column was updated.
Thanks in advance.
Ian
Wise man once said: "Don't ever get married, just find a woman you don't like and buy her a house".
According to ancient Chinese proverb, "Man with hole in pocket feels cocky all day". 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|