Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 trigger update problem?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

331 Posts

Posted - 12/17/2012 :  10:51:45  Show Profile  Reply with Quote
Hi friends

I have table called Customers


and Then I have a trigger for it after Update to insert values into


The problem now is that
When the Customer_Purchase_Date for Customer is changed the the old -new values for the Customer_Pay_Date should not change but they are changing and then at one point old and new values are becoming equal in the audit table.

Same is the Case with Customer_pay_Date . If it changes in CUstomer_Table i want to update only the old and new fields of Customer_Pay_Date in the new row of the audit table..

Hope I am clear..Please excuse me if i did not put it nicely...

Edited by - akpaga on 12/17/2012 10:52:49

Aged Yak Warrior

545 Posts

Posted - 12/17/2012 :  11:27:13  Show Profile  Reply with Quote
I usually make "before update" triggers - have you tried this?
Go to Top of Page

Flowing Fount of Yak Knowledge

4614 Posts

Posted - 12/17/2012 :  14:59:42  Show Profile  Reply with Quote
Can you post yout trigger code? My guess is you are getting the column from the wrong "special" table (inserted/deleted).
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 12/19/2012 :  01:04:12  Show Profile  Reply with Quote
do you mean to say you've separate columns to hold old and new values in audit table?

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000