I have the following code for a trigger:
create trigger trPassDat
ON men
FOR INSERT, UPDATE
AS
declare @man int;
select @man = I.man from men U join inserted I on U.man = I.man
if Not exists (select 'True' from deleted where man = @man)
BEGIN
update men set passdate = getdate() where man = (select man from inserted)
return
END
-- UPDATE
if update(pwd)
BEGIN
update men set passdate = getdate() where man = @man
END
GO
which is supposed to update the password date: unconditionally if we deal with an insert, but password date should be changed only if an update has really changed the password.
This works in SQL Server 2000 but does not in SQL Server 2005. I am quite sure to have made something stupid, but, just in case, someone is aware about some change between SQL Server 2000 and 2005 that could possibly affect the behaviour of this trigger? Namely, the update() function?