November 15, 2006 at 7:56 am
Hello
This is probably a simple question, however I am trying to create a trigger that will update one specific row.
I have a submission webpage and an editor webpage.
What I would like to do is when one of the rows is edited in the editor that the one date feild updates with the new date, but other rows left untouched.
I have a Unique ID feild called ID
the code I have that does not work as when an update is made it modifies the Time of update feild for all the rows
CREATE TRIGGER [update time] ON [dbo].[temp]
FOR UPDATE
AS
UPDATE temp
SET [Time of Update] = getdate()
WHERE
[ID] = (select[ID])
November 15, 2006 at 8:01 am
--FU means for update .
CREATE TRIGGER tr_temp_FU_updateTime ON [dbo].[temp]
FOR UPDATE
AS
SET NOCOUNT ON
UPDATE T
SET [Time of Update] = getdate()
FROM dob.Temp T inner join Inserted I on T.ID = I.ID
November 15, 2006 at 8:37 am
Fantastic....
thanks for you help, could not find his anywhere from my google searches...
Works a treat
November 15, 2006 at 8:39 am
Check out books online (BOL). The section CREATE TRIGGER will surely help you a lot!
You'll also find plenty of information on this site alone!
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy