views:

14

answers:

1

Hi I have the following trigger.

ALTER TRIGGER [dbo].[DivisionLastModified] ON [dbo].[tb_Division] WITH EXECUTE AS CALLER FOR INSERT, UPDATE AS BEGIN UPDATE tb_Division SET LastModified = GetDate() END

This updates all rows however I only wish to modify the update/added row. Is this achievable?

A: 

This is Because you update all Rows

UPDATE tb_Division SET LastModified = GetDate() 

You must specify the last inserted or updated row id,

so you can specify that in Where condition some thing like this

UPDATE tb_Division SET LastModified = GetDate() where id=4
Ramakrishnan
thanks, so now I need to find the identity of the affected row.
Chin