I need a trigger that will prevent from updating the price if the existing value is higher than the inserted value. If such operation transaction appears, the trigger should prevent value update but let transaction end (i.e. not roll it back). The one below doesn't work -- it doesn't let the update happen even if inserted value is higher than existing.
CREATE TRIGGER [dbo].[Prices_InsteadUpdate_Trigger]
ON [dbo].[Prices]
INSTEAD OF UPDATE
AS
SET NOCOUNT ON
IF UPDATE(PRC_Value) AND EXISTS (SELECT *
FROM deleted d
JOIN inserted i
ON d.PRC_PrcId = i.PRC_PrcId
WHERE d.PRC_Value > i.PRC_Value)
SELECT NULL
SET NOCOUNT OFF
Regards, Przemek
SELECT NULL
) from a trigger. If you need a statement that effectively does "nothing", then try:DECLARE @DoNothing INT;
.