Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
DMonnik
Starting Member
2 Posts |
Posted - 2008-05-03 : 20:45:19
|
Hey Everyone,Wasn't sure where to post this exactly but anyway here goes:I have 2 tables called tblMember and tblMember History.Everytime a row in tblMember gets updated the old row (before being updated) is put into tblMemberHistory.In tblMember there is a field called [isChanged] which is set to "yes" on insert or update so i can gather which rows have been changed since my last visit to the db. When i gather all these rows that have changed since my last visit i set the [isChanged] field to "no".My problem is now that when i go through the database and change the value in field [isChanged] to "No" it adds yes another copy of the row into the tblMemberHistory table which i would like to avoid.Is there a method of coding a trigger to do what i currently have it doing but not add another row to the history table when i change [isChanged] to "No"ThanksBELOW IS MY CURRENT TRIGGER CODE:=================================set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgoALTER TRIGGER [MemberUpdated] ON [dbo].[tblMember] AFTER UPDATEAS BEGIN SET NOCOUNT ON; INSERT INTO tblMemberHistory SELECT * FROM DeletedEND |
|
|
|
|