January 9, 2009 at 8:21 am
Hi all,
I've got this trigger that i've somehow thumbled together.
I wanted to update a field called "Lastupdated" with the current date which it does do, but it's updating every record in the table. i'm not sure how to tell it to only update the particular row and not all of them
help!!
Thanks Dave
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER trig_updateQ1ans
ON tbl_Question1Answers
FOR UPDATE
AS
IF NOT UPDATE(questionAns)
BEGIN
RETURN
END
UPDATE tbl_Question1Answers set lastupdated = getdate()
GO
January 9, 2009 at 8:39 am
Duplicate post. No replies to this thread please. Direct replies to: http://www.sqlservercentral.com/Forums/Topic633463-8-1.aspx
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply