Conditional Update stored proc is firing a trigger always

Posted by schar on Stack Overflow See other posts from Stack Overflow or by schar
Published on 2010-03-26T18:54:00Z Indexed on 2010/03/26 19:03 UTC
Read the original article Hit count: 179

Filed under:

I have a stored procedure that says

update table1 set value1 = 1 where value1 = 0 and date < getdate() 

I have a trigger that goes like

CREATE TRIGGER NAME ON TABLENAME
FOR UPDATE
...
if UPDATE(value1) 
BEGIN
--Some code to figure out that this trigger has been called
-- the value is always null
END

Any idea why this trigger is called even when the stored procedure does not update any values?

© Stack Overflow or respective owner

Related posts about SQLServer