To me this is a trigger that will update a date column with the current
datetime.  Your example could see the where clause below that finds the row
that is either just created or just updated.  You can't be changing the
column that is a part of the where clause.

CREATE TRIGGER dbo.MyTable_UpdatedON dbo.Table1FOR INSERT, UPDATE /*
Fire this trigger when a row is INSERTed or UPDATEd */AS BEGIN
  UPDATE dbo.Table1 SET dbo.Table1.LastUpdated = GETDATE()
  FROM INSERTED
  WHERE inserted.id=Table1.idEND


On Tue, Aug 15, 2017 at 10:06 PM, <
[email protected]> wrote:

> MariaDB backend (but could be SQL Server too)
>
> Given this trigger:  UPDATE MyTable SET cItemID = new.cID WHERE cItemID =
> old.cID
>
> My question:  will this trigger fire even if the old.cID = new.cID?  Or do
> I need to add to the WHERE clause something like "....and old.cID <>
> new.cID"
>
> ???
>
> tia,
> --Mike
>
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CAJidMY+bR9Q-H8Py9ZVXkkTrF0OcX0i_7h=5=kkfpggrhzj...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to